image insertion height problem
thsi worked fine for me:
Sub Macro1()
Dim pic As Object
Set pic = ActiveSheet.Pictures.Insert( _
"C:\Documents and Settings\All Users\Documents\My Pictures\Sample
Pictures\Winter.jpg" _
)
With Range("D5:G5")
pic.Top = .Top
pic.Left = .Left
pic.Width = .Width
pic.Height = .Height
End With
End Sub
"thomas donino" wrote:
So far this post has gotten no replies on mrexcel so I post here as well
hoping for some help
The code below sets the range where i want the image to reside and correctly
inserts the image to the range a1:f1 except the height. The image bottom edge
is down at row 4 instead of the bottom of row 1 which i have set the pixel
height before insertion.
Any idea how to set the height properly so it only covers the a1:f1 range?
Sub Test()
'***Change to suit
Const PicName As String = "X:\slksdffsldkfslhf .jpg"
Dim Pic As Object
Set Pic = ActiveSheet.Pictures.Insert(PicName)
ActiveSheet.Select
Rows("1:1").RowHeight = 69
Range("A1:F1").Select
Application.CutCopyMode = False
Selection.Merge True
With Pic
.Top = Range("A1").Top
.Left = Range("A1").Left
.Height = Range("A1").RowHeight 'need to fix this
.Width = Range("A1:F1").Width
End With
End Sub
__________________
Thomas Donino
BATL Management LP
|