PDA

View Full Version : Solved: Start another application using VBA?



andrew93
12-22-2005, 02:59 AM
Hi

I've searched this and the tek-tips forum and am not having much luck. I want to start an application called "ClickYes.exe" using VBA within an Access database but I don't necessarily know which of my users directories it is located in.

The Shell command works ok if I use the full path on my PC, like this :

Shell ("C:\Program Files\ExpressClickYes\ClickYes.exe")

This works fine, but as I said, my users won't necessarily have this application loaded in the same directory.

How can I detect which directory this application is loaded in so I can amend my Shell statement? Or is there another way of starting this application that doesn't involve excessive coding?

TIA, Andrew

{You may ask "Why?" This is part of a much larger process in Access where the user creates a document / report and e-mails a pdf version to their client, and this software temporarily suppresses the outlook alert for automated e-mails. Given this software could be harmful in the wrong hands, I don't want this software running all the time - only when the user needs to use it for sending an e-mail from the database).

Killian
12-22-2005, 03:52 AM
Hi Andrew,

Ideally, the installation of ClickYes.exe would do something useful like set a registry value with it's path that you could check.

If that is not the case it looks like you have 2 options:
1) Prompt the user to locate it for you with a browse dialog.
2) Search the entire local drive for it

The search doesn't really seem feasible - bear in mind that it could be saved in a network location.

I would suggest:
1) Try a default path first (like "C:\Program Files\ExpressClickYes\")
2) If that fails, prompt for a user-specified path
3) Confirm the path and save to the registry (so this process only has to happen once)

andrew93
12-22-2005, 02:42 PM
Unfortunately there isn't a standard registry entry & I don't fanvy searching all available drives so I will give your other suggestions a go.
Thanks very much for the suggestions.
Andrew