Hello all,
I have a weird problem while adding picture to shapes for a specific cell in Excel.
Once the picture is added, it is not being displayed at the required position at run time.But on re-opening the same excel, the image is appearing in the proper position.Also,on debugging i get the required result.Am i missing something here?Iam using Excel 2010
Below is the code snippet that i am using.
Dim shp As Shape
Dim PicRange As Range
Dim strCol As String
Dim strPicFileName As String
Dim varPath As Variant
Dim strPhotoName As String
strPhotoName = Cells(lngRow, SLDataCol.Photo_Link).Value
varPath = Application.Range("SLPicPath").Value & strPhotoName
strCol = "D"
Set PicRange = Range(strCol & lngRow & ":" & strCol & lngRow)
Set shp = shtSL.Shapes.AddPicture(Filename:=varPath _
, LinkToFile:=False, SaveWithDocument:=True, Left:=PicRange.Left, Top:=PicRange.Top, Width:=160, Height:=68)
shtSL.Rows(lngRow & ":" & lngRow).Select
Selection.RowHeight = 70
shp.ControlFormat.PrintObject = True
shp.Placement = xlMoveAndSize
Set PicRange = Nothing
Set shp = Nothing