0

I don't know anything about VBA but I need to get the file name out of a file full path.

So for a string like "c:\something\somethingelse\file.name" I need to get "file.name" out. Also how can you get a quote in a string such as " " "? backslash doesn't seem to work.

2 Answers 2

5

To get a quote in a string use two quotes ("")

To find the location of the slash from the end, use InstrRev()

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks Jon B. Is there a substring equivalent as well?
Jon, well, I'll be darned. I actually learned one useful thing this year. I had no idea that InstrRev existed. Ah, I see it is new in Access 2000.
@Tony Toews: Open the Visual Basic Editor. From the menu, choose: View, Object Browser. Change the dropdown from 'All Libraries' to 'VBA'. For each module and class, study every function and learn what it does. Advance class: learn which functions can be used in Access Database Engine SQL outside of the Access UI.
John, this seems to be a correct and acceptable answer. You might considering accepting it.
0

the DIR() function will return the filename. You need to add a reference to the Microsoft Scripting runtime.

1 Comment

Why would you do that (add the overhead of the entire scripting runtime) when you can simply use built-in string functionality?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.