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,how to insert picture in xls,picture box excel,excel order form with image boxes,excel vba load picture,picturebox excel,vba picturebox,copy vba form picture to excel spreadsheet,excel insert picture,excel picturebox,excel vba image1_click,excel vba resize picture,excel vba to adjust photo image size,excell image box,image1 picture excel,image1->picture excel sheet,insert star on excel cell,microsoft excel problem with image,picturebox vba,private sub image1_click() excel,problem images excel,problems with images in excel,vba excel image1,vba excel loadpicture,vba loadpicture,,access vba load jpg picturebox,add a photo exel,add a photo in an excel workbook,add a picture box to spreadsheet,add a picture to image form in excel vba,add picture comment excel macro,add picture in my excel spreadsheet,add picture to picture image box vba excel,add picture to userform from worksheet,adicionando picture macro excel,cancel loadpicture(application getopenfilename),check for picturebox image,check for picturebox image loaded,code to insert a picture in spreadsheets,code to load picture to worksheet excel from a file,comments fills picture from camera vba excel,como insertar picture box en excel,como insertar un check en excel,como insertar una spreadsheet en un userform,como insertar worksheet en excel,copy embedded image in worksheet to user form,copy picture excel,copy website pictures to excel spreadsheet in vba,create picturebox in a cell excel
Related Excel Tips
Comments
Have another excel answer or questions for this problem ?
Feel free to post it here..















