By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,392 Members | 1,576 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,392 IT Pros & Developers. It's quick & easy.

exporting pivotchart to graphic

P: 58
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

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command13_Click()
  2. Dim outputDir As String
  3. Dim TMC As String
  4. Dim plot_model As String
  5. Dim form_name As String
  6. Dim graphForm As Form
  7.  
  8. TMC = "Select TMC Chart"
  9. outputDir = "C:\"
  10. form_name = "frmSelectTMC"
  11. plot_model = "frmSelectTMC_"
  12.  
  13.  
  14. Set graphForm = Forms(frmSelectTMC)
  15. graphForm.ChartSpace.ExportPicture outputDir & plot_model & TMC & ".jpg", "JPG", 1024, 800
  16.  
  17. End Sub
  18.  
any thoughts would be greatly appreciated
cheers,
Eric
Oct 16 '06 #1
Share this Question
Share on Google+
1 Reply


P: 58
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

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command13_Click()
  2. Dim outputDir As String
  3. Dim TMC As String
  4. Dim plot_model As String
  5. Dim form_name As String
  6. Dim graphForm As Form
  7.  
  8. TMC = "Select TMC Chart"
  9. outputDir = "C:\"
  10. form_name = "frmSelectTMC"
  11. plot_model = "frmSelectTMC_"
  12.  
  13.  
  14. Set graphForm = Forms(frmSelectTMC)
  15. graphForm.ChartSpace.ExportPicture outputDir & plot_model & TMC & ".jpg", "JPG", 1024, 800
  16.  
  17. End Sub
  18.  
any thoughts would be greatly appreciated
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
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form Open (Cancel as Integer)
  2. Me.ChartSpace.ExportPicture "c:\temp\test1.jpg", "JPG" , 1000, 1000
  3. End Sub
Now on the 'frm_forquery' I added a command button called "export"
with the following code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Export_Click()
  2. DoCmd.OpenForm "frm_chartexport", acFormPivotChart
  3. DoCmd.Close asForm, "frm_chartexport
  4. End Sub
its a bad work-around but it at least works, now for more bugs!
Cheers,
Eric
Oct 17 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.