Excel: у меня есть смещение от запрошенной позиции - PullRequest
0 голосов
/ 09 июля 2020

Я хотел бы вставить картинки в другом месте. Он управляется al oop, который помещает каждое изображение в 23 столбца.

'insert le graph
     chemin = ThisWorkbook.Path & "\graph1.jpg"
     cht.Chart.Export Filename:=chemin, filtername:="JPG" ' enregistre le graphique en .jpg
     ActiveWorkbook.Worksheets("Rapport").Pictures.Insert (chemin)
     Dim myShape As Shape
     Set myShape = ActiveWorkbook.Worksheets("Rapport").Shapes(ligne)
 
     With ActiveWorkbook.Worksheets("Rapport")
           myShape.Top = .Range("A" & 23 * (ligne - 1) + 10).Top
           myShape.Left = .Range("A" & 23 * (ligne - 1) + 10).Left
           myShape.Width = .Range("A1:R1").Width
           myShape.Height = .Range("A" & 23 * (ligne - 1) + 10 & ":" & "A" & 23 * (ligne) + 7).Height
           myShape.IncrementRotation 360 'or 90
     End With

С помощью этого кода я получаю для первого изображения: enter image description here

And 23 row below we can see a shift: enter image description here

I don't understand why the Top function of Range don't give the good position.

Thank you in advance for your help !

Edit

I try with the idea of Tim William and now I have a downward shift. введите описание изображения здесь

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...