I have a mymacros.xlam file that opens automatically when called from file mybook.xlsx, with a ribbon and functions for that specific workbook.
From another VBA code, I close mybook.xlsx, and I want to close also mymacros.xlam.
I read on this thread that it is as simple as running
However, it does not (always) work, because mymacros.xlam is not in the Workbooks collection. Sometimes it correctly close the macro file, sometimes it closes my current workbook, sometimes it crashes.
I tried also to write a macro in mymacros.xlam that closes itself, but again, sometimes it works, sometimes it does not.
I am very confused about this behavior. I googled for a way to close and xlam file but I did not find a solution.
Does anybody have experience with this practice?
J. Carlos
From another VBA code, I close mybook.xlsx, and I want to close also mymacros.xlam.
I read on this thread that it is as simple as running
VBA Code:
Workbooks("mymacros.xlam").Close SaveChanges:=False
However, it does not (always) work, because mymacros.xlam is not in the Workbooks collection. Sometimes it correctly close the macro file, sometimes it closes my current workbook, sometimes it crashes.
I tried also to write a macro in mymacros.xlam that closes itself, but again, sometimes it works, sometimes it does not.
I am very confused about this behavior. I googled for a way to close and xlam file but I did not find a solution.
Does anybody have experience with this practice?
J. Carlos