Dear All,
By clicking CommandButton1, Could any one help me insert an image in Userform1 in some where in the worksheet?
Thanks in advance
Dear All,
By clicking CommandButton1, Could any one help me insert an image in Userform1 in some where in the worksheet?
Thanks in advance
Last edited by Axmed.cm; 12-06-2019 at 10:41 AM.
GUURE
Add this code to your UserForm code to handle the button click. This code will create a temporary file based on the picture, insert it to the sheet, then delete the temporary file.
Adapted from a solution by Tim WilliamsPlease Login or Register to view this content.
Dear 6StringJazzer,
Thank you for your help. this is exactly what i wanted. can I resize the picture and put it in specific cell, line cell D3:G6?
Thanks again
Ahmed
To put it in a specific cell, use code to Select that cell before the insert.
"put it in specific cell, line cell D3:G6" That is 12 cells, I'm not sure what you are trying to do there.
You can adjust the display size by adjusting the Shape attributes Height and Width after the insert. After the insert it can be referenced as Sheet1.Shapes(Sheet1.Shapes.Count)
Please Login or Register to view this content.
Thanks dear, its working...
Hi, this piece of code has helped me a lot and works perfectly. I'm struggling with a follow-up problem though: If I save and restart Excel after inserting a shape this way, there's an error message that informs me that "The linked image cannot be displayed. The file may have been moved, renamed, or deleted. Verify that the link points to the correct file and location." The reason is probably that the temp file does not exist anymore, I guess? Is there a way to avoid this while still deleting the temp file at the end of the process?
@Menohavename;
Try this 6StringJazzer's revised code, where the picture is saved on cells D3:G6 exactly also.
Please Login or Register to view this content.
Administrative Note:
Welcome to the forum.
We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.
Please see Forum Rule #4 about hijacking and start a new thread for your query.
If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks