VBA help :)

Status
Not open for further replies.

Blueorangez

New Member
Joined
Dec 15, 2016
Messages
14
Sub ExportRange()

Const FName As String = "C:\TEMP\export.jpg"
Dim rng As Range
Dim shtTemp As Worksheet
Dim chtTemp As Chart

Application.ScreenUpdating = False
'// Change range as needed
Set rng = Worksheets("Daily Roster").Range("A128:K153")

'// Add a temp worksheet. Chart will be placed on this. It will be deleted after
Set shtTemp = Worksheets.Add
'// Add chart
Charts.Add
'// Move the chart to the new sheet and get a reference to it
ActiveChart.Location Where:=xlLocationAsObject, Name:=shtTemp.Name
Set chtTemp = ActiveChart

'// Copy and paste the range
rng.CopyPicture Appearance:=xlScreen, Format:=xlPicture
chtTemp.Paste

'// Export
chtTemp.Export FileName:="C:\Users\user1\Desktop\123.jpeg"

'// Tidy up...
Application.DisplayAlerts = False
shtTemp.Delete
Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub





I have this code above which is working but the picture it exports is to small and not readable.

is there some code that can be added to increase the size of the chart before it is exported?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Status
Not open for further replies.

Forum statistics

Threads
1,214,387
Messages
6,119,222
Members
448,877
Latest member
gb24

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