473,385 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

MS chart not exporting as picture

374 256MB
I am using the following code to export my graph as a picture:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnPrintTheGraph_Click()
  2. On Error GoTo cmdExportGraph_Click_Err
  3.     Dim strErrMsg As String 'For Error Handling
  4.     Dim strFileName As String
  5.     Dim strfilter As String
  6.     Dim lngFlags As Long
  7.     Dim curdated As String
  8.  
  9.     curdated = Format(Now(), "dd-mm-yyyy")
  10.  
  11.  
  12.  
  13.     strFileName = ahtCommonFileOpenSave(Flags:=lngFlags, InitialDir:="", _
  14.         Filter:="PNG Files (*.png)", FilterIndex:=1, DefaultExt:="png", FileName:="MyGraph " & curdated, DialogTitle:= _
  15.         "Save the Graph", OpenFile:=False)
  16.  
  17. Me.ChartSpace.ExportPicture strFileName, , 800, 600
  18.  
  19.  
  20. MsgBox vbCrLf & "The Chart " & strFileName & " has been exported", _
  21.         vbInformation + vbOKOnly, "Chart Exported :"
  22.  
  23. cmdExportGraph_Click_Exit:
  24.     Exit Sub
  25.  
  26. cmdExportGraph_Click_Err:
  27. MsgBox Err.Description & Err.Number
  28.  
  29.             Resume cmdExportGraph_Click_Exit
  30. End Sub

However I get the following error:

Expand|Select|Wrap|Line Numbers
  1. The expression you entered referes to an object that is closed or doesn't exist - 2467
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;

http://img137.imageshack.us/img137/8819/chartissue.png
Attached Images
File Type: jpg chartissue.jpg (58.0 KB, 100 views)
Dec 2 '10 #1
0 1040

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

Similar topics

22
by: PeteCresswell | last post by:
I've been to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mschrt/html/vbobjtitleobject.asp, but still don't have a clue. For example, I've got a chart object namde...
1
by: Steven | last post by:
Hi there, I am trying to export a chart using the Excel11 object from C#. I can properly open workbooks and read cells, but calling Export() on the Chart object throws a COMException ...
2
by: Jess | last post by:
Hi all, I am doing a window application. Now i need to use Matlab to draw a chart and display that chart in my dialog written in C#. How do i do this? I know there is a C# wrapper but it is...
0
by: Pranav | last post by:
I've a web page that displays report data in a data grid an a chart ( I'm using Chart Fx for .Net which creates .PNG files on Server) I've a requirement to export the datagrid and chart both to...
3
by: Scott H | last post by:
Hello, I'm trying it use the Microsoft Office Chart control 11.0 in VB.net (for a windows forms project) and can't seem to get it to work, I've been playing around with various snippets of code....
1
by: Scott H. | last post by:
Hello: I am trying to use Crystal Reports from VS.NET 2003 to produce a simple line chart, where the x axis represents the number of measurements taken and the y axis represents the range of...
4
by: Marcin Zmyslowski | last post by:
Hello! How to prevent from autogenerating chart after opening a form with a chart? I would like to set chart parameters which are located in a form, and then click on a button which let me...
1
by: erbrose | last post by:
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...
0
by: rGh | last post by:
Hello, I am trying to create an Excel chart from C#. I am not a very experieced programmer, so my mistake could be very trivial. The code included is a very simple example. I just wanted to...
3
by: ohioboy | last post by:
I've worked 3 hours to solve this problem and I can't. I'm trying to write code to move data into an excel spreadsheet. When I first open Access and run the code everything works fine. As you...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.