How to open a file in VB6 using app.Path?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: How to open a file in VB6 using app.Path?

Hybrid View

  1. #1
    Join Date
    Jun 2012
    Posts
    13

    How to open a file in VB6 using app.Path?

    When the button is clicked, I want the file to be opened.
    The file will be in the same directory as the visual basic project.
    Therefore, I need the code to open the file using "app.Path".
    Any solutions?

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,982

    Re: How to open a file in VB6 using app.Path?

    What kind of file are we talking about?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jun 2012
    Posts
    13

    Re: How to open a file in VB6 using app.Path?

    Quote Originally Posted by dglienna View Post
    What kind of file are we talking about?
    it's an XPS file (.xps).
    When the button is clicked, I want that file to be opened in windows.

  4. #4
    Join Date
    Dec 2012
    Posts
    38

    Re: How to open a file in VB6 using app.Path?

    You must get the full path of the file, like this

    App.Path & "\" & <name.ext>

    Once you have it, you can call the ShellExecute API function passing as param the string you got before.

  5. #5
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,982

    Re: How to open a file in VB6 using app.Path?

    And OPEN will open the text file, but not decode the XML inside of it.

    http://www.fileinfo.com/extension/xps
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Dec 2012
    Posts
    38

    Re: How to open a file in VB6 using app.Path?

    Quote Originally Posted by dglienna View Post
    And OPEN will open the text file, but not decode the XML inside of it.
    The OPEN argument is not needed and you can also leave a blank string, because the ShellExecute has the open command as default one. See a guide on this API, that provided by AllAPI.net is a very good one.

    Enjoy!

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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center