Results 1 to 40 of 49

Thread: [RESOLVED] Getting the path to a file

Threaded View

  1. #16
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Getting the path to a file

    Trying hard not to laugh here. 24 posts and still a game of "Who's On First?" going on!

    From your image in the last post it appears you want to use relative paths. But I'm probably wrong since that would be such an obvious answer. Just in case, consider the example:
    Code:
    Option Explicit
    
    Private Sub Main()
        Dim Path As String
        Dim F As Integer
    
        Path = App.Path & "\..\Data"
        On Error Resume Next
        GetAttr Path
        If Err Then MkDir Path
        On Error GoTo 0
    
        F = FreeFile(0)
        Open Path & "\Data.txt" For Output As #F
        Print #F, "Some data"
        Close #F
    
        MsgBox "Complete"
    End Sub
    Edit:

    The usual caveats apply in bizarre cases where App.Path is a drive's root directory. Shouldn't happen here though because your image shows all programs in their own subfolders.
    Last edited by dilettante; Mar 6th, 2013 at 01:57 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
  •  



Click Here to Expand Forum to Full Width