Access VBA - if worksheet "budget.xlsx" is open, close it
Hi,
I have a button on a form which the user presses when they're done in access.
How can I make it so that when clicked, this button will close an Excel workbook called "budget.xlsx" only if it's open?
I can close Excel files from an Excel macro using
Windows("budget.xlsx").Activate
ActiveWindow.Close False
but this doesn't work when I paste this into the on click event of my button, and even if it did work, it would produce an error if the file wasn't open.
Any help would be brilliant, thanks
Hi,
I have a button on a form which the user presses when they're done in access.
How can I make it so that when clicked, this button will close an Excel workbook called "budget.xlsx" only if it's open?
I can close Excel files from an Excel macro using
Windows("budget.xlsx").Activate
ActiveWindow.Close False
but this doesn't work when I paste this into the on click event of my button, and even if it did work, it would produce an error if the file wasn't open.
Any help would be brilliant, thanks

Last edited: