DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: how to access a file only with the relative path??

  1. #1
    Join Date
    Jan 2007
    Posts
    1

    how to access a file only with the relative path??

    I would like to know if someone can help me about "relative path" topic??

    I am buiding an application in word with macros and hiperlinks to VB. The application is supposed to work on a dinamic way so it should work in any directory is activated. But actually I have not discovered any way to make reference to relative path in VB6. I have seen the function "GetByRelativePath" but I really do not know how to used it.

  2. #2
    Join Date
    Oct 2005
    Location
    Staffordshire, England
    Posts
    101
    The relative path is the App.Path.
    I've been programming with VB for 15 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

    Martin2k

  3. #3
    Join Date
    Jan 2007
    Posts
    22
    I don't know what do you want exactly
    but (for example)
    if your app is located in C:\MyApp and it writes to a file named "settings.ini" in its directory you can use the following (for example):

    Open "settings.ini" for append as #1
    print #1, MyData
    close #1


    or

    if len(app.path)> 3 then E = "\" else E = ""
    Open app.path & E & "settings.ini" for append as #1
    print #1, MyData
    close #1

    if your file is in a sub-directory Data :

    you can use

    if len(app.path)> 3 then E = "\" else E = ""
    Open app.path & E & "data\settings.ini" for append as #1
    print #1, MyData
    close #1

    you can use "..\settings.ini" to access the parent directory
    in this case it is C:\

    i wish that I understood what you want

Similar Threads

  1. Replies: 8
    Last Post: 03-08-2003, 07:25 PM
  2. File uploading / objFile.Write problem
    By Tomer Cagan in forum ASP.NET
    Replies: 1
    Last Post: 07-24-2001, 09:01 AM
  3. Accessing a MS Access .mdb file
    By Anil kumar in forum VB Classic
    Replies: 1
    Last Post: 03-22-2001, 10:39 AM
  4. Replies: 0
    Last Post: 12-11-2000, 03:32 PM
  5. Replies: 0
    Last Post: 04-17-2000, 01:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center