ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get file's current directory path to a string in VBA? (https://www.excelbanter.com/excel-programming/279713-how-get-files-current-directory-path-string-vba.html)

[email protected]

How to get file's current directory path to a string in VBA?
 
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!

Harald Staff

How to get file's current directory path to a string in VBA?
 
Sub test()
Dim sPath As String
sPath = ActiveWorkbook.Path
MsgBox sPath
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

" wrote in message
...
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!





All times are GMT +1. The time now is 01:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com