title: #VBA #Excel - Stretched and shifted pictures
body: <p>I'm working on a project using VBA with Excel. By clicking a button, we generate an array. One line refers to one product. The information is stored in each column (column A = reference, column B = name...). The generation is made with some code using VBA.<br />
  The problem concerns the pictures. I managed the shape of the pictures, so they are placed in the cell, with a certain height, width, placement...</p>
  <p>When I generate the array from my computer, there's no problem, the pictures are placed perfectly.<br />
  When the array is generated from another computer, the pictures look stretched and shifted. That's it from the 12th line to the end (but the first 11 lines are okay). I don't understand why it starts from the 12th line because the code is exactly the same for every line of the array. And above all, I don't understand why the array isn't well generated on every computer.</p>
  <p>The Excel version is the same and the pictures options too.<br />
  Have you heard about something like that?<br />
  Thanks a lot for your comments!</p>
  <hr />
  <p>Here's the code:</p>
  <pre class="lang-vb prettyprint-override"><code>Function SetImageViewer(Ref As String, Cell As Range) As String
      Dim cmt As Comment
      Dim sPicName As String
      Dim ImageCell As Range
      Dim OrderFormWS As Worksheet
      
      sPicName = GetParameter(&quot;PicturesPath&quot;) &amp; &quot;\&quot; &amp; Ref &amp; &quot;.jpg&quot;
      Set ImageCell = Cell.MergeArea
      Set OrderFormWS = ThisWorkbook.Sheets(&quot;OrderForm&quot;)
  
      sPicFile = Dir(sPicName)
      If sPicFile &lt;&gt; vbNullString Then
          
          Set Pic = OrderFormWS.Shapes.AddPicture(sPicName, linktofile:=msoFalse, SaveWithDocument:=msoCTrue, Left:=0, Top:=0, Width:=0, Height:=0)
          With Pic
              .LockAspectRatio = msoTrue
              .Left = ImageCell.Left + 5
              .Top = ImageCell.Top + 5
              .Width = 40
              .Height = 40
              .Placement = xlMoveAndSize
          End With
          
          Set cmt = Cell.Comment
          If cmt Is Nothing Then Set cmt = Cell.AddComment()
          cmt.Text &quot; &quot;
          cmt.Shape.Fill.UserPicture sPicName
          cmt.Shape.Height = 300
          cmt.Shape.Width = 300
          SetImageViewer = ChrW(&amp;H25BA)
      Else
          Set cmt = Cell.Comment
          If Not cmt Is Nothing Then cmt.Delete
          SetImageViewer = &quot;No picture&quot;
      End If
  End Function
  </code></pre>