I need to pick your brains about closing excel!

spearson

New Member
Joined
Dec 19, 2006
Messages
14
First a little background information.

I have a coldfusion/teradata driven web application. At some point the user needs to do some data manipulation so they click a link and an excel workbook launches in the internet explorer window (not in Excel itself).

The workbook itself operates fine, it loads data from the database, saves data to the database and does all the necessary interactions for the user to manipulate data. The problem is when the user needs to exit the workbook.

I have a command button on a worksheet that acts as a back button. When clicked, it directs the web browser away from the excel workbook and back to the web application (this is needed because the page they go back to needs to reload after using the workbook and the back button on the browser won't do that). The issue at hand is that I can't seem to close excel when I browse away from the workbook. I have tried application.quit, application.workbooks(me.name).close, application.workbooks(thisworkbook.name).close, application.activeworkbook.close, application.workbooks(hardcoded name).close. I have tried these right after I do my call to the web browser, and code does execute after I redirect the browser as I have seen with debug.print statements that execute.

Also, the workbook_beforeclose doesn't execute UNLESS I go into the vbe and click the stop button, then and only then do any of the .close commands work.

I need this to close because if the user wants to go back manipulate more data, and they click the link to launch the workbook again, I get an error message saying that the workbook is still open and you can't have two workbooks with the same name open.

How can I close Excel, or the workbook?

Right now I am forced to open the task manager and manually end excel before I can open it again.

Any ideas (other than opening the workbook in Excel instead of the web browser)?
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,214,808
Messages
6,121,686
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top