pivotchart to image! how do I do it. found in help, not working

E

Eric Brose

Howdy all!
I need help exporting a pivotchart to a .png
I have a form 'frm_forquery' that allows a user to select a value called
"TMC", this then runs a query and opens the pivotchart 'frm_selectTMC' based
on that users selection.
I would like to export the chart to a jpg..
I added a command on 'frm_forquery' and have been working on this code, but
i keep getting run-time error '2467' the expression you entered refers to a
object that is closed or doesn't exist....
here is the command code

Code:

Private Sub Command13_Click()
Dim outputDir As String
Dim TMC As String
Dim plot_model As String
Dim form_name As String
Dim graphForm As Form

TMC = "Select TMC Chart"
outputDir = "C:\"
form_name = "frmSelectTMC"
plot_model = "frmSelectTMC_" S
et graphForm = Forms(frmSelectTMC)

graphForm.ChartSpace.ExportPicture outputDir & plot_model & TMC & ".jpg",
"JPG", 1024, 800 End Sub


Seen other posts with similiar problems
cheers,
Eric
 
E

Eric Brose

Eric Brose said:
Howdy all!
I need help exporting a pivotchart to a .png
I have a form 'frm_forquery' that allows a user to select a value called
"TMC", this then runs a query and opens the pivotchart 'frm_selectTMC' based
on that users selection.
I would like to export the chart to a jpg..
I added a command on 'frm_forquery' and have been working on this code, but
i keep getting run-time error '2467' the expression you entered refers to a
object that is closed or doesn't exist....
here is the command code

Code:

Private Sub Command13_Click()
Dim outputDir As String
Dim TMC As String
Dim plot_model As String
Dim form_name As String
Dim graphForm As Form

TMC = "Select TMC Chart"
outputDir = "C:\"
form_name = "frmSelectTMC"
plot_model = "frmSelectTMC_" S
et graphForm = Forms(frmSelectTMC)

graphForm.ChartSpace.ExportPicture outputDir & plot_model & TMC & ".jpg",
"JPG", 1024, 800 End Sub


Seen other posts with similiar problems
cheers,
Eric

Here is the work-around that I found for anyone who cares....
I copied/paste my pivotchart form 'frm_selectTMC' and called the copy
'frm_chartexport'
In the form properties of 'frm_chartexport' i built an event procedure for
"on open" with the following code
Code:

Private Sub Form Open (Cancel as Integer) Me.ChartSpace.ExportPicture
"c:\temp\test1.jpg", "JPG" , 1000, 1000 End Sub


Now on the 'frm_forquery' I added a command button called "export"
with the following code
Code:

Private Sub Export_Click() DoCmd.OpenForm "frm_chartexport",
acFormPivotChart DoCmd.Close asForm, "frm_chartexport End Sub


its a bad work-around but it at least works, now for more bugs!
Cheers,
Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top