https://chandoo.org/forum/threads/vb-code-to-insert-pdf-image.42675/
This is cross post, was not getting reply so posting here.
[FONT="]I am using following code and it is importing jpeg image in cell range B14 : P[/FONT][FONT="]28 (Merge cells)
[/FONT]
[FONT="]I need vb code which can insert pdf file as image in the same merge range, the picture should be fixed in range, thanks
[/FONT]
This is cross post, was not getting reply so posting here.
[FONT="]I am using following code and it is importing jpeg image in cell range B14 : P[/FONT][FONT="]28 (Merge cells)
[/FONT]
[FONT="]I need vb code which can insert pdf file as image in the same merge range, the picture should be fixed in range, thanks
Code:
[/FONT][/COLOR][COLOR=#141414][FONT=inherit]Sub GetPic()[/FONT][/COLOR]
<code style="box-sizing: border-box; font-family: inherit; font-size: 1em;">
Dim fNameAndPath As Variant
Dim pRng As Range
Dim pTop As Long, pLeft As Long, pHeight As Long, pWidth As Long
fNameAndPath = Application.GetOpenFilename(Title:="Select Picture To Be Imported")
If fNameAndPath = False Then Exit Sub
Set pRng = ActiveSheet.Range("C15")
With pRng.MergeArea
pTop = .Top
pLeft = .Left
pHeight = .Height
pWidth = .Width
End With
ActiveSheet.Pictures.Insert(fNameAndPath).Select
With Selection.ShapeRange
.LockAspectRatio = msoFalse
.Left = pLeft
.Top = pTop
.Width = pWidth
.Height = pHeight
End With
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
</code>[COLOR=#141414][FONT=inherit]End Sub[/FONT][/COLOR][COLOR=#141414][FONT="]