Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2013 VBA CopyFromRecordSet opens Excel Window

Status
Not open for further replies.

Pegasus51

Programmer
Apr 11, 2005
4
US
I recently converted an Access 2003 adp DB (that we ran in Access 2007) to a 2013 accdb DB. We have code that creates an Excel file in the background (i.e. not visible) for an eventual mailmerge. This worked fine in 2007, but in 2013 it opens the Excel window and shows all the processing steps it is taking to create the spreadsheet. We do not want the user to see this happening.

These two statementse are executed before creating the workbook:
oExcel.Visible = False
oExcel.DisplayAlerts = False

This works fine until it hits a CopyFromRecordset statement. At that time Excel displays and you can see the data filling in. Unfortunately, there is a bit of a delay after Excel is opened and the data is filled in. I am worried that the user will think something is wrong and close Excel or something.

Again in Access 2007, the 2003 adp VBA behaved as we wanted it to by keeping Excel hidden so the user did not see the file being created. I stepped through the code and determined it is the CopyFromRecordSet that is displaying Excel as the active window.

Any help is appreciated.
 
I only have office 2007 but what about oExcel.Activeworkbook.visible=false?



 
Hi,

Include
Code:
oExcel.Visible = False
oExcel.DisplayAlerts = False
oExcel.ScreenUpdating = False

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Thanks for your replies. Neither methods suggested work.
 
Please post your code.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top