type function for use within a Access Database? I have alot of pathing going on inside my DB and would like to make it easier. Is there anything similar to the app.path in VB?
Printable View
type function for use within a Access Database? I have alot of pathing going on inside my DB and would like to make it easier. Is there anything similar to the app.path in VB?
There are a few depending on what you need the path of.
Application.CurrentDB.Name = "C:\RobDog888.mdb"
Application.SysCmd acSysCmdAccessDir = Access Installation Path
'...
'...
Hi RobDog888,
How about if I just wanted to use app.path for this statement?
Workbooks.Open FileName:= App.Path & "MyExcel.xls"
Thanks
Quote:
Originally Posted by RobDog888
App.Path is a VB6 function. If your automating Excel from VB6 then its ok.
Excel also has Application.Path but its the path of Excel and not the workbook
There is the WorkBook.Path too. ;)
Is this the correct syntax? I tried, but it says "object required"
Workbooks.Open FileName:=Workbook.Path & "MyExcel.xls"
Please help or point me to some reading materials.
Thanks,
Iat
Quote:
Originally Posted by RobDog888
Sorry, it should be ActiveWorkbook.Path instead of Workbook.path but if your trying to open a workbook the there is no workbook or path.
Where are you trying to open it from? Path of Excel program, path of current open workbook, or ?
I have a macro (macro.xls) that lives in c:\temp folder. This macro.xls will open another .xls (MyExcel.xls) file that also in that same folder.
Some how this syntax (below) worked just fine at my work pc but the same syntax with the same folder structure didn't work at home because it can't find the MyExcel.xls file.
Workbooks.Open FileName:="MyExcel.xls"
In VB6 I would just add App.path & "\" & "MyExcel.xls" but need the same effect in VB Office.
TIA
Iat
Then since one workbook is opening another yo will need to use -
ActiveWorkbook.Path
Thanks RobDog88. ActiveWorkbook.path did it!!!! Do you know are there any reading references on the net where I can look up VBA for Excel?
Thanks again,
Iat
Here at vb forums or just a google search but I think we have allot here. :D
Besoup :Quote:
Originally Posted by RobDog888
If you are in ADO try : CurrentProject.path
in addition to RogDogs post :)