I think this should be straightforward but can't quite get what I am looking for.
I have my vba script in one workbook and want to use it to reference a workbook that I manually open, the name of the second workbook will change so needs to be able to suit this.
I have used the following code to close all open workbooks except where the vba is held.
Changing the line
to
gets me the file names, however I want to ensure it ignores the file name of where the script is held, how do I update for this?
Thanks,
EMcK
I have my vba script in one workbook and want to use it to reference a workbook that I manually open, the name of the second workbook will change so needs to be able to suit this.
I have used the following code to close all open workbooks except where the vba is held.
Code:
Sub CloseAllWorkbooks()
Dim WkbkName As Object
For Each WkbkName In Application.Workbooks()
WkbkName.Save
If WkbkName.Name <> ThisWorkbook.Name Then WkbkName.Close
Next
End Sub
Changing the line
Code:
WkbkName.Save
Code:
WkbkName.Name
Thanks,
EMcK