LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Insert Photo - error on cancel

Hi,

I have the following code for a picture box to load an image file:

Private Sub Image1_Click()

FileToOpen = Application.GetOpenFilename("All Files
(*.jpg),*.jpg,(*.bmp),*.bmp")
Worksheets("Sheet1").OLEObjects("Image1").Object.P icture _
= LoadPicture(FileToOpen)

End Sub

which works fine unless I click "cancel" instead of selecting an image file,
at which point there is an error.

How to I allow the process to abort cleanly on "cancel"?

Thanks!


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I insert a photo into a specific cell? Artemis Bob Excel Discussion (Misc queries) 4 May 16th 10 09:27 AM
Help- Insert text if photo file not available Stevep4 Excel Discussion (Misc queries) 6 January 23rd 09 04:34 PM
Insert Photo - help Stevep4 Excel Discussion (Misc queries) 1 January 17th 09 12:59 AM
How to insert a photo in the background for printing. HoganD87 Excel Discussion (Misc queries) 1 August 20th 07 09:24 PM
Looping to insert photo Akader Excel Programming 8 February 28th 07 07:19 AM


All times are GMT +1. The time now is 06:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"