Can I map a program (.exe) to abutton in a form?

DPK99

New member
Local time
Yesterday, 23:24
Joined
Feb 26, 2008
Messages
6
I would like to place a button on a form that maps to a program on a user's computer. For example, the button says PROGRAM and then the user clicks on the button and it opens an executable located at c:\PROGRAM\program.exe

I am assuming that I can do that with access, but how?

Thanks for any help!
 
Dim RetVal
RetVal = Shell("c:\PROGRAM\program.exe")

???
 
Dim RetVal
RetVal = Shell("c:\PROGRAM\program.exe")

???

Thanks. I was able to get it to run the .exe by inserting a command button, then choosing Run Application and browsing to the .exe file. I don't know how to use the code you recommended?

AA follow up question: Can I run a non executable file like a .doc by linking it to a button so that it will automatically open the associated program and specific file. Right now I receive an "invalid procedure call or argument" error. I want users to be able to open a specific word file from a form.
 
You can use FollowHyperlink to do that (or Shell, but Shell requires the executable).
 
Something like below should open your file

Dim objWrd As Object
Dim wrdDoc As Object

Set objWrd = CreateObject("Word.Application")

Set wrdDoc = objWrd.Documents.Open("PathToFile")

objWrd.Visible = True
 

Users who are viewing this thread

Back
Top Bottom