How to get file's current directory path to a string in VBA?

W

wenkej

In my VBA I needed to get some data from another Excel
file located in the same directory with current host excel
file.How could I got the current file's path ,something
the same as "../" in UNIX?
Thanks!
 
H

Harald Staff

Sub test()
Dim sPath As String
sPath = ActiveWorkbook.Path
MsgBox sPath
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

Top