Export to Excel Hides Spreadsheet

B

bhikku

All,

I am working an Access form which exports a recordset to an existing Excel
spreadsheet template, then saves the spreadsheet with a new file name. The
problem is when I open the new spreadsheet in Excel the workbook is hidden.
I have to select Window/Unhide in Excel to make the spreadsheet visible. How
is this happening?

Here is the code:

'Open the blank order sheet
Set xlbook = GetObject("c:\temp\blankordersheet.xls")
Set xlsheet = xlbook.worksheets("Sheet1")

'Populate the blank order sheet with recordset
xlsheet.cells(16, 1).copyfromrecordset rst

'Save the worksheet as a new file with a name from a text field
xlbook.SaveAs ("c:\temp\" & txtOrderSheetID & ".xls")
xlbook.Close
Set xlbook = Nothing

b
 
Top