Thread: Chart Size
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Thomas Wieser Thomas Wieser is offline
external usenet poster
 
Posts: 11
Default Chart Size

Hi Eric,

It is not possible to set any other attributes for the Export method, so
I use this workaround. Important: The width and height values are in
"Points", not in pixels - 1 point = 4/3 pixels! That's why I had a width
of 4800 pixels instead of 3600.


So: I did it in the same way as Jon posted below. I resize the chart in
that way that the relation between width and height is the same as
before. Important: The AutoScaleFont attribute of the chart must be set
to True.

Dim akt_x As Integer
Dim akt_y As Integer
Dim factor As Integer

akt_x = Worksheets(1).ChartObjects(1).Width
akt_y = Worksheets(1).ChartObjects(1).Height

factor = 2700 / akt_x
Worksheets(1).ChartObjects(1).Width = 2700
Worksheets(1).ChartObjects(1).Height = akt_y * factor



Then, I set the Window Zoom to 25% to enable the user to see everything.
Therefore, I have to unfocus the chart and focus a cell element, don't
know why. For me, it is important that the user can see what Excel is
doing, and if there is any display error, the user can change the chart
manually.

Worksheets(1).Range("A1").Select
ActiveWindow.Zoom = 25


Finally, I do the export to a PNG file, should also work with GIF files:

Worksheets(1).ChartObjects(1).Chart.Export _
FileName:="C:\myfile.png", _
FilterName:="PNG", _
Interactive:=True




Regards, Thomas


Eric Van Buren schrieb:
Thomas - Sorry, I don't have any experience with doing with the Export
method. Although your workaround is interesting to me. Could you
please post the complete code that you used for project to export the
gifs? Thanks.