Export Image and Set Image Size

njskatchmo

New Member
Joined
Mar 29, 2011
Messages
13
I am trying to export graphs from a workbook that are each on their own worksheet. I am using the following code:

Sub ExportImages2()

Dim oCht As Chart
Set oCht = Chart1

On erRROR GoTo Err_Chart

oCht.Export Filename:="H:\MyDocuments\GovExp.png", Filtername:="png"

Err_Chart:
If Err <> 0 Then
Debug.Print Err.Description
Err.Clear
End If

End Sub

When I export the graph, it seems to select the dimensions randomly. How can I set the image size to be 800x600?
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
So I've resized the images in excel and can exert some control over the output size this way, but graphs that are the same sizes in excel sometimes come out close (within 50 pixels) of the same size, but not always the same sizes. Any ideas?
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,259
Members
452,901
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top