|
Question : Excel modifications
|
|
on opening workbook getting error "Unable to get the Open property of the Workbooks class"
DoCmd.OutputTo acOutputReport, "ConsIncGroup", acFormatXLS, "C:\Data\ConsIncGroup.xls", 0 'DoCmd.OutputTo acOutputReport, "repIncomeStatement_LastYearsCons_Grouped", acFormatXLS, , -1 DoEvents
Dim mysheet As Object, xlApp As Object
Set xlApp = CreateObject("Excel.Application") Set mysheet = xlApp.Workbooks.Open("C:\Data\ConsIncGroup.xls").Sheets(1)
mysheet.Cells(1, 1).Value = "Test"
mysheet.Application.ActiveWorkbook.Save mysheet.Application.ActiveWorkbook.Close xlApp.Quit
' Clear the object variable. Set mysheet = Nothing
|
|
Answer : Excel modifications
|
|
Hey dmitry, how goes it?
Can you open the exported spreadsheet normally having exported it? Does it perform any better if you skip the explicit Excel object creation (not ideal I know)...
------------------------------------------------------------------------------ DoCmd.OutputTo acOutputReport, "ConsIncGroup", acFormatXLS, "C:\Data\ConsIncGroup.xls", 0 'DoCmd.OutputTo acOutputReport, "repIncomeStatement_LastYearsCons_Grouped", acFormatXLS, , -1 DoEvents
Dim mysheet As Object, mybook As Object, xlApp As Object
Set mybook = GetObject("C:\Data\ConsIncGroup.xls") Set xlApp = mybook.Application Set mysheet = mybook.Sheets(1) xlApp.Visible = True 'etc etc ------------------------------------------------------------------------------
Or - if that doesn't help - perhaps giving up and making a file copy in code and opening that copy - deleting the "original" export when all's done.
|
|
|
|