I'm using VBA in Excel to read a spreadsheet and modify its contents. I need to save the results with a name that is similar to the original file, but with some alterations.
How can I programmatically find the name of the currently open file using vba?
ThisWorkbook.Name
will return the file name.
ThisWorkbook.FullName
will return the directory structure and the file name.
It depends, here are two possibilities:
Debug.Print ActiveWorkbook.Name
For Each wk In Workbooks
Debug.Print wk.Name
Next
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With