Round Face
New Member
- Joined
- May 23, 2011
- Messages
- 2
Hi All,
Would you please help me to embed images using ShowPicD. Showpicd which I found in this forum has been a life saviour. The only problem is that we cant send the files to customers as it shows that the linked image cannot be displayed. Please see the
Damon Ostrander code below:
http://www.mrexcel.com/board2/viewto...nction&start=0
Function ShowPicD(FileName As String, Optional Path As String = \\QSERV\Images, Optional Extention As String = ".jpg") As Boolean<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
'Same as ShowPic except deletes previous picture when picfile changes<o></o>
Dim AC As Range<o></o>
Static P As Shape<o></o>
Dim VShft As Integer, HShft As Integer<o></o>
VShft = Range("W6") 'amount to shift picture up or down<o></o>
HShft = Range("W5") ' amount to shift picture left or right<o></o>
On Error GoTo Done<o></o>
Set AC = Application.Caller<o></o>
If PicExists(P) Then<o></o>
P.Delete<o></o>
Else<o></o>
'look for a picture already over cell<o></o>
For Each P In ActiveSheet.Shapes<o></o>
If P.Type = msoLinkedPicture Then<o></o>
If P.Left >= AC.Left + HShft And P.Left < AC.Left + HShft + AC.Width Then<o></o>
If P.Top >= AC.Top + VShft And P.Top < AC.Top + VShft + AC.Height Then<o></o>
P.Delete<o></o>
Exit For<o></o>
End If<o></o>
End If<o></o>
End If<o></o>
Next P<o></o>
End If<o></o>
Set P = ActiveSheet.Shapes.AddPicture(Path + "\" + FileName + Extention, True, False, AC.Left + HShft, AC.Top + VShft, 70, 70) '200 x 200 pixels, change to desired size<o></o>
P.Select<o></o>
Selection.ShapeRange.ZOrder msoBringToFront<o></o>
Selection.ShapeRange.Shadow.Visible = msoFalse<o></o>
ShowPicD = True<o></o>
Exit Function<o></o>
Done:<o></o>
ShowPicD = False<o></o>
End Function<o></o>
<o></o>
Function PicExists(P As Shape) As Boolean<o></o>
'Return true if P references an existing shape<o></o>
Dim ShapeName As String<o></o>
On Error GoTo NoPic<o></o>
If P Is Nothing Then GoTo NoPic<o></o>
ShapeName = P.Name<o></o>
PicExists = True<o></o>
NoPic:<o></o>
PicExists = False<o></o>
End Function<o></o>
Would you please help me to embed images using ShowPicD. Showpicd which I found in this forum has been a life saviour. The only problem is that we cant send the files to customers as it shows that the linked image cannot be displayed. Please see the
Damon Ostrander code below:
http://www.mrexcel.com/board2/viewto...nction&start=0
Function ShowPicD(FileName As String, Optional Path As String = \\QSERV\Images, Optional Extention As String = ".jpg") As Boolean<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
'Same as ShowPic except deletes previous picture when picfile changes<o></o>
Dim AC As Range<o></o>
Static P As Shape<o></o>
Dim VShft As Integer, HShft As Integer<o></o>
VShft = Range("W6") 'amount to shift picture up or down<o></o>
HShft = Range("W5") ' amount to shift picture left or right<o></o>
On Error GoTo Done<o></o>
Set AC = Application.Caller<o></o>
If PicExists(P) Then<o></o>
P.Delete<o></o>
Else<o></o>
'look for a picture already over cell<o></o>
For Each P In ActiveSheet.Shapes<o></o>
If P.Type = msoLinkedPicture Then<o></o>
If P.Left >= AC.Left + HShft And P.Left < AC.Left + HShft + AC.Width Then<o></o>
If P.Top >= AC.Top + VShft And P.Top < AC.Top + VShft + AC.Height Then<o></o>
P.Delete<o></o>
Exit For<o></o>
End If<o></o>
End If<o></o>
End If<o></o>
Next P<o></o>
End If<o></o>
Set P = ActiveSheet.Shapes.AddPicture(Path + "\" + FileName + Extention, True, False, AC.Left + HShft, AC.Top + VShft, 70, 70) '200 x 200 pixels, change to desired size<o></o>
P.Select<o></o>
Selection.ShapeRange.ZOrder msoBringToFront<o></o>
Selection.ShapeRange.Shadow.Visible = msoFalse<o></o>
ShowPicD = True<o></o>
Exit Function<o></o>
Done:<o></o>
ShowPicD = False<o></o>
End Function<o></o>
<o></o>
Function PicExists(P As Shape) As Boolean<o></o>
'Return true if P references an existing shape<o></o>
Dim ShapeName As String<o></o>
On Error GoTo NoPic<o></o>
If P Is Nothing Then GoTo NoPic<o></o>
ShapeName = P.Name<o></o>
PicExists = True<o></o>
NoPic:<o></o>
PicExists = False<o></o>
End Function<o></o>