|
-
Mar 6th, 2013, 04:40 PM
#41
Re: [RESOLVED] Getting the path to a file
 Originally Posted by jmsrickland
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.
-
Mar 6th, 2013, 04:40 PM
#42
Re: Getting the path to a file
 Originally Posted by jmsrickland
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.
-
Mar 6th, 2013, 04:57 PM
#43
Re: [RESOLVED] Getting the path to a file
 Originally Posted by dilettante
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.
-
Mar 6th, 2013, 05:00 PM
#44
Re: [RESOLVED] Getting the path to a file
No.
App.Path never changes.
-
Mar 6th, 2013, 05:03 PM
#45
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.
-
Mar 6th, 2013, 06:39 PM
#46
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".
-
Mar 6th, 2013, 06:49 PM
#47
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.
-
Mar 6th, 2013, 06:59 PM
#48
Re: [RESOLVED] Getting the path to a file
Ah, ok. Well I'm glad your happy with what dilettante told you.
-
Mar 7th, 2013, 03:19 AM
#49
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|