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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If / Then help in Starting Excel from Access 1

Status
Not open for further replies.

pdldavis

Technical User
Oct 29, 2001
522
US
Hi, I have an option group in Access where the first Select Case statement starts Excel and opens a specific file. The problem I'm having is depending on the version of Office, Excel can be in a different subdirectory.

I would like to include an If/Then statement that says if Excel doesn't exist in this folder, look for it in another folder, else error message. Or if there's a better way....

Existing:
Case 1
Call Shell("C:\Program Files\Microsoft Office\Office10\Excel.exe C:\Export\CableTransferSheet.xls", 1)

Would like to change to:
Case 1
If(Call Shell.....A)= not found,(Call Shell....B),"Error"

Any help would be appreciated.

Thanks
 
You shouldn't need the exact location for Excel. It's a base program and will run when called with just "excel.exe"

So you should just be able to take out the path information like:

Call Shell("excel.exe C:\...", 1)

and it'll find Excel and start it.

DreamerZ
 
Thank you very much! That never occured to me. Works like a champ.
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top