exporting pivotchart to graphic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • erbrose
    New Member
    • Oct 2006
    • 58

    exporting pivotchart to graphic

    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_"
    
        
    Set graphForm = Forms(frmSelectTMC)
    graphForm.ChartSpace.ExportPicture outputDir & plot_model & TMC & ".jpg", "JPG", 1024, 800
    
    End Sub
    any thoughts would be greatly appreciated
    cheers,
    Eric
  • erbrose
    New Member
    • Oct 2006
    • 58

    #2
    Originally posted by erbrose
    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_"
    
        
    Set graphForm = Forms(frmSelectTMC)
    graphForm.ChartSpace.ExportPicture outputDir & plot_model & TMC & ".jpg", "JPG", 1024, 800
    
    End Sub
    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_chartexpor t'
    In the form properties of 'frm_chartexpor t' 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

    Comment

    Working...