Stephen Forero
asked on
Insert Picture problem
Hi All,
I have the following code that goes out to my network, grabs a picture from a particular directory and pastes to my excel sheet. Then the excel sheet gets automatically emails out to people. What I just noticed is that the people I send to, they dont have access to same network folders, so they cannot see image. Is there a way to hardcode picture in excel?
I have the following code that goes out to my network, grabs a picture from a particular directory and pastes to my excel sheet. Then the excel sheet gets automatically emails out to people. What I just noticed is that the people I send to, they dont have access to same network folders, so they cannot see image. Is there a way to hardcode picture in excel?
InsertPictureInRange "I:\Macro\Database\JeffLogo.jpg", Range("A1")
Sub InsertPictureInRange(PictureFileName As String, TargetCells As Range)
' inserts a picture and resizes it to fit the TargetCells range
Dim p As Object, t As Double, l As Double, w As Double, h As Double
If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub
If Dir(PictureFileName) = "" Then Exit Sub
' import picture
Set p = ActiveSheet.Pictures.Insert(PictureFileName)
' determine positions
With TargetCells
t = .Top
l = .Left
w = .Offset(0, 3.75).Left - .Left
h = .Offset(3.75, 0).Top - .Top
End With
' position picture
With p
.Top = t
.Left = l
.Width = w
.Height = h
End With
Set p = Nothing
End Sub
ASKER
Unfortunately I need to leave in excel format.
ASKER
I am also using excel 2010
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
perfect, works... thank you!
Since you email the file out, send it as a PDF and the image will be converted.
You did not specify a version to work with and options vary by version.