Link to home
Start Free TrialLog in
Avatar of raj27
raj27

asked on

Open .jpg with a button click.

I have a "xyz.jpg" document on my desktop, which I want to open with a button click from VB. I have the path to the file. I have no clue how to start with. Could someone help me out.

Thanx.
Avatar of fluglash
fluglash

Shell(pathname, [windowstyle])
Avatar of raj27

ASKER

fluqlash,
Ur command starts the .exe file, not a particular jpeg file. The pathname in ur command would be the path to an EXE file. I want a jpeg picture to open with a command button click.
ASKER CERTIFIED SOLUTION
Avatar of Egore
Egore

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
fluglash was right though.
The shell command needs an exe, parameters and windowstyle
Something like:
    Shell "c:\winnt\notepad.exe c:\boot.ini", vbNormalFocus
works.
Don't forget when you use the shell command to give the dos based path (8.3) of the pic otherwise it won't open the file.
Shell "C:\Program Files\Internet Explorer\iexplore.exe C:\Documents and Settings\MyFakeAccount\Desktop\my personal testfile for EE.htm", vbNormalFocus

This works OK for me xThorx
That's luck. Try to launch a word document with longpath, it will launch the word but not the document! So the real safe way to use shell is to use the smallpath to the files.
I know xThorx, in fact Egore's suggestion is the best.
In all cases the use of Shel is a bit dangerous because asynchro, i.e. the shell command is executed whatever the calling programme does.

Ciao

Rem