Exporting a JPEG of a Table

tbeynon1

New Member
Joined
Sep 16, 2015
Messages
15
I have this code and it produces a jpeg of the range that I select and stores the file in the place i have designated for it. However the problem I have is that it produces a new sheet in the work book which i don't want, if anyone has any ideas that would be a great help.

Code:
Private Sub CommandButton1_Click()
Dim sSheetName As String
Dim oCht As Chart


'Worksheet to work on
sSheetName = "Del to SREP"




Worksheets(sSheetName).Range("A1:C3").CopyPicture xlScreen, xlBitmap
Set oCht = Charts.Add


With oCht
    .Paste
    .Export Filename:="C:\Users\tom.beynon\Documents\Screen Rips\Del to SREP.jpg", Filtername:="JPG"
End With
    




End Sub
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Add these lines before the End Sub:

Code:
Application.DisplayAlerts = False
oCht.Delete
Application.DisplayAlerts = True

WBD
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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