Insert Picture

M

maximus73

when I use, ActiveSheet.Pictures.Insert(stringVariable).Select,
receive the following error.

Runtime error '1004':

Unable to get the Insert property of the Pictures class

If I use, ActiveSheet.Pictures.Insert("c:\mypicture.jpg").select, i
works fine.

?????
 
D

Dave Peterson

I'd guess that your stringVariable doesn't contain a real filename--just a
typo???

I'd check first:

Dim StringVariable As String
Dim testStr As String
Dim myPict As Picture

StringVariable = "C:\asdf.jpg"

testStr = ""
On Error Resume Next
testStr = Dir(StringVariable)
On Error GoTo 0

If testStr = "" Then
MsgBox StringVariable & " doesn't exist"
Else
Set myPict = ActiveSheet.Pictures.Insert(StringVariable)
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top