I've created a form that displays two Pivotcharts at a time. I want to create a command button that exports the data in both charts to the same Excel file in separate worksheets.
So far I've come up with the following code:
Which works fine when I export the first chart. Is there a way to add the data from my second Pivotchart (a form) to a different sheet in my already created Excel file.
I'd really like to use the DoCmd.OutputTo routine because it keeps the formatting of the data and such with just the one line of code.
So far I've come up with the following code:
Code:
Dim objExcelApp As Excel.Application
Set objExcelApp = CreateObject("Excel.Application")
Dim strFrmName As String
strFrmName = Me.fsubIndividualChart.SourceObject
DoCmd.OutputTo acOutputForm, strFrmName, _
acFormatXLS, strExcelFileName, True, , False
objExcelApp.Cells.Columns.AutoFit
Which works fine when I export the first chart. Is there a way to add the data from my second Pivotchart (a form) to a different sheet in my already created Excel file.
I'd really like to use the DoCmd.OutputTo routine because it keeps the formatting of the data and such with just the one line of code.