Page 2 of 2 FirstFirst 12
Results 41 to 49 of 49

Thread: [RESOLVED] Getting the path to a file

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

    Re: [RESOLVED] Getting the path to a file

    Quote Originally Posted by jmsrickland View Post
    So, actually, Path = "..\Data" is better than Path = App..Path & "\..Data"
    Not really, but it works in the degenerate case where CD = App.Path. When that isn't true everything falls apart!

    Note that even using File Open or File Save common dialogs can change the CD of a program while it runs.

    So if you mean App.Path always use App.Path.

  2. #42
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Getting the path to a file

    Quote Originally Posted by jmsrickland View Post
    Actually, it's your fault. If you had responded earlier there wouldn't have been 24 posts
    I had no idea what you wanted until you drew a picture.

  3. #43

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] Getting the path to a file

    Quote Originally Posted by dilettante View Post
    Not really, but it works in the degenerate case where CD = App.Path. When that isn't true everything falls apart!

    Note that even using File Open or File Save common dialogs can change the CD of a program while it runs.

    So if you mean App.Path always use App.Path.
    If I use Path = App.Path & "..\Data"

    and then later use a common dialogue to find a file somewhere else will that screw up Path?


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  4. #44
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: [RESOLVED] Getting the path to a file

    No.

    App.Path never changes.

  5. #45

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] Getting the path to a file

    OK, thanks. I changed it back to Path = App.Path & "..\Data"


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  6. #46
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: [RESOLVED] Getting the path to a file

    HAHA This thread is awsome! I think you (jmsrickland) already the answer of your question. Simple, use "App.Path".

  7. #47

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: [RESOLVED] Getting the path to a file

    No, Max. I only knew of App.Path & "\Data\Myfile.text" but that would not have worked. What I didn't know was App.Path & "..\Data" which dilettante posted.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

  8. #48
    PowerPoster
    Join Date
    Aug 2011
    Location
    B.C., Canada
    Posts
    2,887

    Re: [RESOLVED] Getting the path to a file

    Ah, ok. Well I'm glad your happy with what dilettante told you.

  9. #49
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [RESOLVED] Getting the path to a file

    Is there is way to get the path of a file that is not in the App.Path?
    while this appears to be resolved, the searchtreeforfile API appears to fulfill the original request
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Page 2 of 2 FirstFirst 12

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