Email Active Sheet as jpeg

JonElCanche

Board Regular
Joined
Aug 25, 2011
Messages
59
I would like to email only the active sheet of my workbook when clicking a button. The best would be to email it as a jpeg or paste values only. Is there some code that would send this automatically to a predetermined email address?
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

bensonsearch

Well-known Member
Joined
May 26, 2011
Messages
844
Hi,
you can send the workbook with

Code:
activeworkbook.send ('details here)

the only thing is this sends the workbook itself as an attachment.

the only other ways I can think of is to email based on a variable which gets data from say A1:N100 and pastes it in the body

or

use printscreen to save a pic of it then make an email with that attached.

let me know which option if any of these and I can explain further
 

JonElCanche

Board Regular
Joined
Aug 25, 2011
Messages
59
Hi,
you can send the workbook with

Code:
activeworkbook.send ('details here)
the only thing is this sends the workbook itself as an attachment.

the only other ways I can think of is to email based on a variable which gets data from say A1:N100 and pastes it in the body

or

use printscreen to save a pic of it then make an email with that attached.

let me know which option if any of these and I can explain further


Creating a macro to copy and paste the desired cells in the body of an email would work perfect. How would that be done?
 

bensonsearch

Well-known Member
Joined
May 26, 2011
Messages
844
ok so below is the code to create an email in vba to send via outlook for range a1:n10

Code:
Dim OutApp As Object
    Dim OutMail As Object
    Dim strbody As String
 
    Dim user As Variant
 
    user = 'email address to send to
 
 strbody = sheets("Sheet1").range("A1:n10").value
 
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)
    strbody = 'body of email
    On Error Resume Next
    With OutMail
        .To = user
        .CC = ""
        .BCC = ""
        .Subject = "Subject goes here"
        .body = strbody
        'You can add a file like this
        '.Attachments.Add ("C:\test.txt")
        .Send   'or use .Display
    End With
    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing

adjust range and sheet name plus email address and done :)
 

Watch MrExcel Video

Forum statistics

Threads
1,129,754
Messages
5,638,170
Members
417,011
Latest member
Amaden95

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
Top