Thread: Insert Picture
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Insert Picture

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




maximus73 wrote:

when I use, ActiveSheet.Pictures.Insert(stringVariable).Select , I
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").se lect, it
works fine.

??????

--
maximus73
------------------------------------------------------------------------
maximus73's Profile: http://www.excelforum.com/member.php...o&userid=25877
View this thread: http://www.excelforum.com/showthread...hreadid=522865


--

Dave Peterson