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

Return path where macro is stored 1

Status
Not open for further replies.

JoeAtWork

Programmer
Jul 31, 2005
2,285
CA
I would like to open a file that is stored in the same directory as the macro I am running. Is there a property or function that would return the directory path to me?

I.E. something similar to MS Access's CurrentProject.Path property.


 
I'm not a pro, but it seems like when I write my VBA macro's if I want it to open a file in the same directory I just tell it to open the file without a path to it. Then it goes to the directory that the macro was launched from. But that is VBA for MS office. I don't know if that is any help or not.
 
You can check VBA.FileSystem.CurDir$ for the current directory, but this will always be \Accpac\Runtime when you launch a macro.
There is no .Path property for VBA macros though, so you need to pick a folder and hardcode it, or use something like AccpacSession.SharedDataPathOnServer & "\Macros" to place your macros and the supporting files.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top