Hi,
I want to click a button in an Excel file to open a picture in a folder my company, eg ("C:\Users\XX\Desktop\FOLDER1\1.jpg")
How can I do that?
Thanks
Hi,
I want to click a button in an Excel file to open a picture in a folder my company, eg ("C:\Users\XX\Desktop\FOLDER1\1.jpg")
How can I do that?
Thanks
the easiest way would be to use Shell to call a program passing the file name as a parameter... like:
[VBA]Shell "mspaint.exe C:\Users\XX\Desktop\FOLDER1\1.jpg"[/VBA]
Thank you for your reply.Originally Posted by Sean.DiSanti
Your code is work.
However, i don't want to use mspaint to open the photo.
I have tried to use "WLXPhotoGallery.exe"
it is at C:\Program Files\Windows Live\Photo Gallery\WLXPhotoGallery
However, my code is not work
Sub photo_Click()
Shell "WLXPhotoGallery.exe C:\Users\XX\Desktop\FOLDER1\1.jpg"
End Sub
Could you please tell me any mistake on my code?
I think the problem is at WLXPhotoGallery.exe
On the other hand, how can i insert a picture by checking a button?
Thanks
use the full path:
[VBA]Shell "C:\Program Files\Windows Live\Photo Gallery\WLXPhotoGallery\WLXPhotoGallery.exe C:\Users\XX\Desktop\FOLDER1\1.jpg"[/VBA]
i didn't list the path in mine because mspaint is located in system32 and can be called without the path written out.
What do you mean by open? Are you trying to insert it into a spreadsheet?
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
it looks like he wants to open it in another program, i think this one can be marked solved
hi Sean.DiSanti,Originally Posted by Sean.DiSanti
Your code does work.
However, the picture will be closed automatically just after it opens.
it looks like he wants to open it in another program
yes
closed automatically? it shouldn't be
closed automatically? it shouldn't beOriginally Posted by Sean.DiSanti
yes closed automatically.
Now, I use another way
ActiveSheet.Pictures.Insert (" file' location + flie's name)
This work.
It inserts a picure instead of opening the picture by another program
Thanks