RunApp

N

Nightshade

I have the created a Macro for a RunApp with a command line of:

C:\Program Files\Microsoft Office\OFFICE11\EXCEL.exe "N:\Desktop\Tech
Database\Report-Province.xls"

This works fine, however I do have a question. Is there any way to change
this command line, so that it does not look in the N drive then Desktop then
the Tech Databse folder, but instead looks in the same folder that the access
database is in? I want to be able to move my folder to different places and
still have this code work.
 
6

'69 Camaro

Hi.
Is there any way to change
this command line, so that it does not look in the N drive then Desktop
then
the Tech Databse folder, but instead looks in the same folder that the
access
database is in?

If you move the XLS file, then you must change this code's file path
(N:\Desktop\Tech Database\) to the new path where the XLS file is located.
Therefore, if the XLS file is always in the same directory as the database
application, then try the following syntax, and ensure that there's a space
character after the file name of the executable and a slash character before
the Excel file name:

stAppName = "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE " & _
CurrentProject.Path & "\Report-Province.xls"

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
L

Larry Daugherty

Access and "macro" are words that don't go together well. If you use
VBA ("macro" in all other Office platforms) you can easily do what you
ask.

HTH
 
6

'69 Camaro

Hi.

I'm sorry. I misread your question. You have a macro, not a VBA procedure.
The code I gave you will work in a procedure created by the Command Button
Wizard. Run the Wizard to automatically create the procedure's code for
you, and replace the line of code that's hard coded with the N:\ drive path
to what I've given you. Save and compile the code, then open the form in
Form View and select the button to open your spreadsheet file.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top