Vba Workbook Name And Path. These two UDF's will place the name of a Workbook into a cell, or the Workbooks File path and name. I tried it as captured in the snippet below but keep getting a compiler error.
The following macro (named Open_Workbook_Basic), opens the Excel workbook whose name is "Example - VBA open workbook". Function GetBook(myRange As Range) As String ' Returns name of the workbook in which a range is located as a String. Close SaveChanges:=True 'Close method has additional parameters 'Workbooks.
I am trying to specify the path by specifying the same path as the current workbook is that of the other open workbook to close too.
We may want to know Workbook path and its location.
These will print the names of all open workbooks to the Immediate Window(Ctrl + G). So if the Path/Name of the file changes you need to change the VBA code of the Macro. If you know which file you want to open, you can specify its name in the function.