GetOpenFilename : dir & filename

  • Thread starter Thread starter Bob Beattie
  • Start date Start date
B

Bob Beattie

Hi all,

Using the GetOpenFilename command, is there an easy way to extract the
directory part to a string and the filename to another string?

Cheers,
Bob.
 
Bob said:
Hi all,

Using the GetOpenFilename command, is there an easy way to extract the
directory part to a string and the filename to another string?

Cheers,
Bob.

Sub test()
Dim whole$, folder$, fname$, pos%
whole$ = Application.GetOpenFilename
pos% = InStrRev(whole$, "\")
folder$ = Left$(whole$, pos%)
fname$ = Mid$(whole$, pos% + 1)
MsgBox folder$ & vbLf & vbLf & fname$
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top