Results 1 to 4 of 4

Thread: [RESOLVED] How do you find the Install Path/Location of the EXE?

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    15

    Resolved [RESOLVED] How do you find the Install Path/Location of the EXE?

    I want to create a button that opens a supplied word document in their standard word handler like office or openoffice. But how do you find the Location of the exe (Or its folder) and using it to open the Word Document.

    I have tried to use
    VBCode Code:
    1. Function GetFilenameOnly(ByVal Fullpath As String) As String
    2.     Return System.IO.Path.GetFileNameWithoutExtention(FullPath)
    3. End Function
    with no use. Please help!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How do you find the Install Path/Location of the EXE?

    If you want to open a data file in the default application for that file type, you don't have to know what that application is. You just call Process.Start and pass the path of the data file and the system will do the rest. It's just as though you double-clicked the data file in Windows Explorer.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    15

    Re: How do you find the Install Path/Location of the EXE?

    Quote Originally Posted by jmcilhinney View Post
    If you want to open a data file in the default application for that file type, you don't have to know what that application is. You just call Process.Start and pass the path of the data file and the system will do the rest. It's just as though you double-clicked the data file in Windows Explorer.
    What i want is a method to find the location of the folder with the exe, since it can be installed anywhere on the harddrive. Then I need to open the word file inside that folder.

  4. #4
    Member
    Join Date
    Oct 2008
    Posts
    40

    Re: How do you find the Install Path/Location of the EXE?

    The code your looking for is:

    Application.StartupPath

    For me thats a life saver )

Tags for this Thread

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