Results 1 to 11 of 11

Thread: is there an app.path....

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    is there an app.path....

    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?

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: is there an app.path....

    There are a few depending on what you need the path of.

    Application.CurrentDB.Name = "C:\RobDog888.mdb"
    Application.SysCmd acSysCmdAccessDir = Access Installation Path
    '...
    '...
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    Addicted Member
    Join Date
    Feb 2004
    Location
    Texas
    Posts
    144

    Re: is there an app.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
    There are a few depending on what you need the path of.

    Application.CurrentDB.Name = "C:\RobDog888.mdb"
    Application.SysCmd acSysCmdAccessDir = Access Installation Path
    '...
    '...

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: is there an app.path....

    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.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5
    Addicted Member
    Join Date
    Feb 2004
    Location
    Texas
    Posts
    144

    Re: is there an app.path....

    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
    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.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: is there an app.path....

    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 ?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7
    Addicted Member
    Join Date
    Feb 2004
    Location
    Texas
    Posts
    144

    Re: is there an app.path....

    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

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: is there an app.path....

    Then since one workbook is opening another yo will need to use -
    ActiveWorkbook.Path
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9
    Addicted Member
    Join Date
    Feb 2004
    Location
    Texas
    Posts
    144

    Re: is there an app.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

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: is there an app.path....

    Here at vb forums or just a google search but I think we have allot here.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: is there an app.path....

    Quote Originally Posted by RobDog888
    There are a few depending on what you need the path of.

    Application.CurrentDB.Name = "C:\RobDog888.mdb"
    Application.SysCmd acSysCmdAccessDir = Access Installation Path
    '...
    '...
    Besoup :
    If you are in ADO try : CurrentProject.path
    in addition to RogDogs post

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width