On Friday, August 27, 2010 3:00 AM Gato Gato wrote:
I see that this is a pretty old post, but I just ran into the same issue and took me a while but finally figured out the solution.
The Sintax for the Export method of the Chart object is:
expression.Export(Filename, [FilterName], [Interactive]) as described at
http://msdn.microsoft.com/en-us/library/aa195722(office.11).aspx
Now, even though the FilterName and Interactive parameters are optional, and should not represent trouble at all, the Interactive one is the one that does.
This parameter should be set to True to display the dialog box that contains the filter-specific options and, as the user is not at the server, the parameter should be set to False. The default value is False, but when using the object from outside VBA (like in this case, creating it in C#.NET), it doesn't take it as False and an Exception is raised.
So, on line 66 where you have:
objexcel.ActiveChart.Export("C:\Inetpub\wwwroot\spreadsheets\sav\test.gif", "gif")
it should be
objexcel.ActiveChart.Export("C:\Inetpub\wwwroot\spreadsheets\sav\test.gif", "gif", False)
and that should solve the problem.
Lucas