How to run a windows Shortuct from Access

MikeSr

Registered User.
Local time
Today, 15:33
Joined
Jul 30, 2009
Messages
24
I have a shortcut that is created by another program(windows program). When I double click the shortcut from my desktop, the appliation launches. The application I am speaking about creates shortcuts and runs various internal macros.
I need to select one of the Windows/ Application shortucts from Access 2007 and run it. I have used the shell command, but it only works for executables.
Is there a way to launch the shortcut from VBA?
 
If you look at the properties of the shortcut, there should be a field called Target. That is what you want to shell out. Make sure you include any switches (denoted by a - or a /) See if that works.
 
Thanks, but I should be more specific. I am using a program called Workspace Macro Pro. This program creates macros to do things like start a program, run it for 60 seconds and then shut it down. You can create many macros. The program creates desktop shortcuts for each macro.
Hope that makes sense.
Any way, the shortcut target looks like this :
c:\users\MikeSr\Documents\Workspace Macro Pro\My Macros\KEP1.WKSP"

So you can see that the .WKSP is not an executable.
I wish I had a method of calling this from Access 2007
 
Hi

as you haven't been dead specific and we all have to hazard a guess, are you calling the shortcut via vba with .lnk extension?

Ns
 
Why not just run the program itself?

Well, that would be the easiest thing to do....

but :)

Thanks, but I should be more specific. I am using a program called Workspace Macro Pro. This program creates macros to do things like start a program, run it for 60 seconds and then shut it down. You can create many macros. The program creates desktop shortcuts for each macro.
Hope that makes sense.
Any way, the shortcut target looks like this :
c:\users\MikeSr\Documents\Workspace Macro Pro\My Macros\KEP1.WKSP"

Much like a Word document has an extension of .doc, and when you double click it it actually launches Word.exe, I'm gonna guess that .wksp is an extension that actually launches an .exe program. If you go into the folder options of any folder and check out File Types and look for WKSP, you will find the actual executable for your program.
 
Hi

that was my next thought Bob. The only thing I could think that might warrant the shortcut being used instead would be if

the program was to run minimized or maximized
the target string had extra cmd lines

other than that, running the program should work just as well.



Regs

nigel
 
Well, that would be the easiest thing to do....

but :)



Much like a Word document has an extension of .doc, and when you double click it it actually launches Word.exe, I'm gonna guess that .wksp is an extension that actually launches an .exe program. If you go into the folder options of any folder and check out File Types and look for WKSP, you will find the actual executable for your program.

A bit like when you click an . Accdb and access starts???

He has already mentioned the program that is being used. If you click on any filetype, it will open the associated exe unless of course, you have a file but not the program......

In any case, he knows the filetype and the program and wants to open the specific file.

Ns
 
Thanks for your help. I contacted the Macro Pro Software mfr and this is what they came up with :
Dim RetVal As String

Set wsShell = CreateObject("wscript.shell")
Set proc = wsShell.Exec("C:\Program Files\Workspace Macro Pro 6.5\Workspace
Macro Pro.exe send-email.wksp /u")

//Shell command is asynchronous so it will not wait till macro finishes. Wait for 30 seconds.
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 30
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime

//use proc.ExitCode to check the return value.
RetVal = proc.ExitCode
The highlighted "Purple" is the solution.
Thanks again for your posts.
 

Users who are viewing this thread

Back
Top Bottom