Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening Images with VBA

Status
Not open for further replies.

GilesC

MIS
Aug 24, 2001
13
GB
Hi,
I have a problem in that I want to be able to specify the path of an image, stored in a text box and by clicking a button I want the correct application to open up and display the image.
So far I've used

dim myFilePath as string
myFilePath=txtFilePath
Shell "Path of Application " & myFilePath

Which is working well unless myFilePath has a space in it!
Please help.
Thanks,
Giles
 
Try using the ShellExecute API call:
Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Call ShellExecute(0&, vbNullString, myFilePath, vbNullString, vbNullString, 5)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top