G
Guest
Access 2003, app saved in 200 format, Windows XP, Office 2003
I am exporting reports to excel using
DoCmd.OutputTo acOutputQuery, strSQL, acSpreadsheetTypeExcel9, strpath
After the query is exported to excel, I run some code to format the report.
After user has chosen file name and place to save the report from common
save dialog, I pop up a form asking user to wait.
This pop up form has a cancel button, I have tried a couple of different
ways to make this cancel button work
1. I opened a hidden form and in the main code to export and format the
report I checked to see if the hidden form was open and if it was I exitted
the sub and cleaned up
2. after 1. didn’t work because it took too long to open the hidden form, I
set a boolean variable to cancel after the cancel button was clicked on the
pop up form. In the main code to export and format the report I checked to
see if the cancel variable was set to true and if it was I exitted the sub
and cleaned up
Neither of the above worked
I noticed that while access is getting the data and opening excel, I can’t
click the cancel button on the pop up form, because access is showing its
hourglass, (I haven’t set hourglass to true in any code).
By the time I can get the cancel button to respond to a click, it is too
late and
Application.followhyperlink is opening the report in Excel.
Is there any known way to cancel an export to excel after it has started?
Thanks
I am exporting reports to excel using
DoCmd.OutputTo acOutputQuery, strSQL, acSpreadsheetTypeExcel9, strpath
After the query is exported to excel, I run some code to format the report.
After user has chosen file name and place to save the report from common
save dialog, I pop up a form asking user to wait.
This pop up form has a cancel button, I have tried a couple of different
ways to make this cancel button work
1. I opened a hidden form and in the main code to export and format the
report I checked to see if the hidden form was open and if it was I exitted
the sub and cleaned up
2. after 1. didn’t work because it took too long to open the hidden form, I
set a boolean variable to cancel after the cancel button was clicked on the
pop up form. In the main code to export and format the report I checked to
see if the cancel variable was set to true and if it was I exitted the sub
and cleaned up
Neither of the above worked
I noticed that while access is getting the data and opening excel, I can’t
click the cancel button on the pop up form, because access is showing its
hourglass, (I haven’t set hourglass to true in any code).
By the time I can get the cancel button to respond to a click, it is too
late and
Application.followhyperlink is opening the report in Excel.
Is there any known way to cancel an export to excel after it has started?
Thanks