file Pick - name only not path

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

file Pick - name only not path

Post by CData »

hi again,

I have FileDialog code that results in the full path ...\folderA\folderB\MyDatabase.accdb

The user needs to browse / file explore to find the correct accdb - - - but what then what is needed to save is only the file name: MyDatabase.accdb

I can string parse that by finding the last "\" symbol
but I was wondering if there was a property in FileDialog method that provided it? ...without the path

have googled about quite a bit but can't seem to zero in on that question....

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: file Pick - name only not path

Post by HansV »

No, the FileDialog always returns the path + filename. So you'll have to parse the string, or use the Dir function: Dir(path + filename) returns just filename.
Best wishes,
Hans

CData
3StarLounger
Posts: 308
Joined: 24 Dec 2015, 16:41

Re: file Pick - name only not path

Post by CData »

Dir() works great! thanks for the tip.