I have created an Excel spreadsheet which calls a Stored Procedure which works fine but I want to put some additonal validation in the spreadsheet which will stop a user closing the spreadsheet if the procedure is still executing.
I am looking to utilise the "Private Sub Workbook_BeforeClose(Cancel As Boolean)" event but if I reference the ADODB.Command variable which was called in the original "Private Sub Workbook_Open()" I get the error "Run Time Error 424 Object Required".
I have tried to create a Boolean variable instead of referencing the ADODB.Command but it seems as if I try to reference anything from the original "Private Sub Workbook_Open()" event in the "Private Sub Workbook_BeforeClose(Cancel As Boolean)" it can't see it?
I have tried changing the Events to Public but this had no effect. Can this be programmed in VBA, I'd like put a prompt in the
"Private Sub Workbook_BeforeClose(Cancel As Boolean)" event which indicates to the user the stored procedure is still being executed and then determine how to proceed by their reponse.
I am looking to utilise the "Private Sub Workbook_BeforeClose(Cancel As Boolean)" event but if I reference the ADODB.Command variable which was called in the original "Private Sub Workbook_Open()" I get the error "Run Time Error 424 Object Required".
I have tried to create a Boolean variable instead of referencing the ADODB.Command but it seems as if I try to reference anything from the original "Private Sub Workbook_Open()" event in the "Private Sub Workbook_BeforeClose(Cancel As Boolean)" it can't see it?
I have tried changing the Events to Public but this had no effect. Can this be programmed in VBA, I'd like put a prompt in the
"Private Sub Workbook_BeforeClose(Cancel As Boolean)" event which indicates to the user the stored procedure is still being executed and then determine how to proceed by their reponse.