VBA Copy range as image has low resolution?

daveasu

Board Regular
Joined
Jan 4, 2012
Messages
53
I have some VBA code that finds named ranges throughout a workbook and saves those ranges as images.

The code works great, but the resolution of the images is not that great. If you do a manual screen capture of the range and put that image next to the image created from the macro, there is a noticeable difference in the resolution.

I've read online that Format:=xlBitmap will create a high resolution image, but is there a way to increase the resolution so that the text in the image is easier to read?

VBA Code:
Sub Export_Pictures()
    Dim Nm As Name
    Dim rgExp As Range
   For Each Nm In Names
        If Nm.Name Like "Week*" Then 
          Range(Nm).CopyPicture Appearance:=xlScreen, Format:=xlBitmap
          With ActiveSheet.ChartObjects.Add(Left:=Range(Nm).Left, Top:=Range(Nm).Top, Width:=Range(Nm).Width, Height:=Range(Nm).Height)
                .Name = "TempArea"
                .Activate
           End With
          ActiveChart.Paste
           ActiveSheet.ChartObjects("TempArea").Chart.Export "C:\Users\user\Dropbox\" + Nm.Name + ".png"
           ActiveSheet.ChartObjects("TempArea").Delete
        End If
    Next
End Sub
 
Last edited by a moderator:

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Actually, have you tried to copy the picture of your range as a picture (xlPicture), instead of a bitmap (xlBitmap)?
 
Upvote 0
Domenic thank you for the response. Gave that a try, but it didn't make an improvement. Not sure if the "print screen" resolution is going to be possible :)
 
Upvote 0
Hi daveasu. Here's a link that might help. Dave
 
Upvote 0
The way I save an Excel file as a high resolution picture is first to save it as a PDF file. Then, you can save PDF as a 600 dpi jpg file. If you have Adobe Acrobat, I think the whole process can be automated though I have never tried it.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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