Problem When Inserting Image or Picture Box
Sponsor
Problem When Inserting Image or Picture Box [Q]
Ive a problem when i try to insert/add image or picture box on my excel spreadsheet, I use the following code for a image or 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.Picture _
= LoadPicture(FileToOpen)
End Sub
The excel code above 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”?
Problem When Inserting Image or Picture Box [A]
Here’s excel tips to insert image or picture box on excel spreadsheet:
Check the cancel button on return from getting the file name. Try:
Private Sub Image1_Click()
FileToOpen = Application.GetOpenFilename( _
“All Files (*.jpg),*.jpg,(*.bmp),*.bmp”)
If FileToOpen <> False Then
Worksheets(”Sheet1″).OLEObjects(”Image1″).Object.Picture _
= LoadPicture(FileToOpen)
End If
End Sub
Rate This Tips:
Incoming excel search terms
,excel vba picturebox,picture box excel,excel vba load picture,excel vba loadpicture,how to insert picture in xls,vba loadpicture,excel order form with image boxes,excel picturebox,picturebox excel,vba fit userform1 image1 picture,vba picturebox,copy vba form picture to excel spreadsheet,excel insert picture,excel vba image1_click,excel vba insert picture,excel vba resize picture,excel vba to adjust photo image size,excell image box,how to insert a picture box in excel,image1 picture excel,image1->picture excel sheet,insert star on excel cell,microsoft excel problem with image,picturebox vba,private sub image1_click(),private sub image1_click() excel,problem images excel,problems with images in excel,vba excel image1,vba excel loadpicture,visual basic upload image to excel user form image1_click,access vba load jpg picturebox,add a photo exel,add a photo in an excel workbook,add a picture box on userform in excel,add a picture box to spreadsheet,add a picture to image form in excel vba,add picture box to excel form,add picture comment excel macro,add picture in my excel spreadsheet,add picture to excel worksheet vba,add picture to picture image box vba excel,add picture to userform,add picture to userform from worksheet,add picturebox to excel form,adicionando picture macro excel,call sub vba to insert picture in image form,cancel loadpicture(application getopenfilename),check for picturebox image
Related Excel Tips
Comments
One Comment on Problem When Inserting Image or Picture Box
-
Rohan raut on
Sat, 20th Mar 2010 6:56 am
can i add the picture box instead of image box .
if hav any solution then please forwoeded the answer to my mail id.
Thank you
Have another excel answer or questions for this problem ?
Feel free to post it here..















