Excel Macro help with inserting a picture into a rectangle?
Greetings. I am currently struggling to get an Excel Macro to work. What it must do is the moment you select the rectangle it display the "File insert diagram" and then after you selected the image it must insert the image into the selected shape. Here is an example of the code i was trying to combine but i keep on getting debug errors
"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg"
In the above code, i need a string instead of a default picture to be inserted, the file insert must pop up where you usually browse for a picture and then insert it into the selected range
Picture = Application.GetOpenFilename(ImgFileFormat)
I have searched and attempted many pages but i could not find a solution to this problem and if anyone can help me in this code it would be much appreciated.
In short here is a summary of what it must do
1. You select the rectangle shape
2. You click the button with the macro assigned to it
3. The fileopen dialogue appears and you browse for the picture
4. It gets inserted into the shape
- General_PayneLv 58 years agoFavorite Answer
This works for me:
On Error GoTo cancel:
'Only leave Application.GetOpenFilename if you don't want the default search restricted to JPG files
Picture = Application.GetOpenFilename(".jpg Files (*.jpg), *.jpg")
- brynestadLv 44 years ago
oh dont think of u can with that cellular,srry yet u can if u deploy the excell 2007 u can pass to the cellular place and deploy it there the place ever u offered the cellular.. wish this facilitates chum!