Office XP FileDialog question

M

Mick

This is probably staring me in the face but I can't find the answer so would
appreciate help. I am using the XP FileDialog to obtain a file name which
then becomes a text value in a field on an Access form. I can get the full
path but I cannot figure how to get just the file name except by parsing the
string. I know how to get the file name using WSH FileSystemObject but can't
figure how to do it in Access VBA. Can somebody please tell me what I'm
missing?
Thanks


Dim dlgOpen As FileDialog
Dim vrtSelectedItem As Variant

Set dlgOpen = Application.FileDialog(msoFileDialogOpen)
dlgOpen.Show
vrtSelectedItem = dlgOpen.SelectedItems(1) ' gives full path
 
R

Ron Weiner

How about:

strJustFileName = mid(vrtSelectedItem ,instrrev(vrtSelectedItem ,"\")+1)

Ron W
 
M

Mick

Thanks for that Ron. It'll save me a bit of time brushing up on string
manipulation functions. Still wondering if there is a built-in method to do
this just out of interest.
 

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

Top