How to embed images using ShowPicD

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-com:office:office" /><o:p></o:p>
'Same as ShowPic except deletes previous picture when picfile changes<o:p></o:p>
Dim AC As Range<o:p></o:p>
Static P As Shape<o:p></o:p>
Dim VShft As Integer, HShft As Integer<o:p></o:p>
VShft = Range("W6") 'amount to shift picture up or down<o:p></o:p>
HShft = Range("W5") ' amount to shift picture left or right<o:p></o:p>
On Error GoTo Done<o:p></o:p>
Set AC = Application.Caller<o:p></o:p>
If PicExists(P) Then<o:p></o:p>
P.Delete<o:p></o:p>
Else<o:p></o:p>
'look for a picture already over cell<o:p></o:p>
For Each P In ActiveSheet.Shapes<o:p></o:p>
If P.Type = msoLinkedPicture Then<o:p></o:p>
If P.Left >= AC.Left + HShft And P.Left < AC.Left + HShft + AC.Width Then<o:p></o:p>
If P.Top >= AC.Top + VShft And P.Top < AC.Top + VShft + AC.Height Then<o:p></o:p>
P.Delete<o:p></o:p>
Exit For<o:p></o:p>
End If<o:p></o:p>
End If<o:p></o:p>
End If<o:p></o:p>
Next P<o:p></o:p>
End If<o:p></o:p>
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:p></o:p>
P.Select<o:p></o:p>
Selection.ShapeRange.ZOrder msoBringToFront<o:p></o:p>
Selection.ShapeRange.Shadow.Visible = msoFalse<o:p></o:p>
ShowPicD = True<o:p></o:p>
Exit Function<o:p></o:p>
Done:<o:p></o:p>
ShowPicD = False<o:p></o:p>
End Function<o:p></o:p>
<o:p></o:p>
Function PicExists(P As Shape) As Boolean<o:p></o:p>
'Return true if P references an existing shape<o:p></o:p>
Dim ShapeName As String<o:p></o:p>
On Error GoTo NoPic<o:p></o:p>
If P Is Nothing Then GoTo NoPic<o:p></o:p>
ShapeName = P.Name<o:p></o:p>
PicExists = True<o:p></o:p>
NoPic:<o:p></o:p>
PicExists = False<o:p></o:p>
End Function<o:p></o:p>
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,224,504
Messages
6,179,144
Members
452,891
Latest member
JUSTOUTOFMYREACH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top