I am using the following code to export my graph as a picture:
However I get the following error:
I have attached the setup of my form and the properties of the graph.
Thanks for any help!
Edit:
The attachment has shrunk the image so here is a link;
Code:
Private Sub btnPrintTheGraph_Click()
On Error GoTo cmdExportGraph_Click_Err
Dim strErrMsg As String 'For Error Handling
Dim strFileName As String
Dim strfilter As String
Dim lngFlags As Long
Dim curdated As String
curdated = Format(Now(), "dd-mm-yyyy")
strFileName = ahtCommonFileOpenSave(Flags:=lngFlags, InitialDir:="", _
Filter:="PNG Files (*.png)", FilterIndex:=1, DefaultExt:="png", FileName:="MyGraph " & curdated, DialogTitle:= _
"Save the Graph", OpenFile:=False)
Me.ChartSpace.ExportPicture strFileName, , 800, 600
MsgBox vbCrLf & "The Chart " & strFileName & " has been exported", _
vbInformation + vbOKOnly, "Chart Exported :"
cmdExportGraph_Click_Exit:
Exit Sub
cmdExportGraph_Click_Err:
MsgBox Err.Description & Err.Number
Resume cmdExportGraph_Click_Exit
End Sub
However I get the following error:
Code:
The expression you entered referes to an object that is closed or doesn't exist - 2467
Thanks for any help!
Edit:
The attachment has shrunk the image so here is a link;