jnevada
10-16-2008, 08:53 PM
I'm working on a Access application that opens an excel template, do some calculatge then the spreadsheet opens (final report). template and final report are not same work book.
Is this possible that the template doesn't open at all?
....
'code on Access application
Set xlwb = xlApp.Workbooks.Open("D:\path1\path2\template.xlsm")
Set xlws = xlApp.Worksheets("Data")
xlws.Range("A6:J10000").ClearContents
xlApp.ScreenUpdating = False
xlws.Visible = xlSheetHidden
....
'code on excel template
Application.ScreenUpdating = False
Sheets("Data").Select 'Data is a sheep of template.xlsm 'error here,
'runtime error 1004 -- select method
'of worksheet class failed
......
This error is because the I set xlws.Visible = xlSheetHidden.
Is this possible that the template doesn't open at all?
....
'code on Access application
Set xlwb = xlApp.Workbooks.Open("D:\path1\path2\template.xlsm")
Set xlws = xlApp.Worksheets("Data")
xlws.Range("A6:J10000").ClearContents
xlApp.ScreenUpdating = False
xlws.Visible = xlSheetHidden
....
'code on excel template
Application.ScreenUpdating = False
Sheets("Data").Select 'Data is a sheep of template.xlsm 'error here,
'runtime error 1004 -- select method
'of worksheet class failed
......
This error is because the I set xlws.Visible = xlSheetHidden.