VBA to email Excel 2016 Range as JPG in body - not visibleIs there a way to crack the password on an Excel VBA Project?How to avoid using Select in Excel VBAReferring to Dynamic Named Ranges in VBAHow to add excel range as a picture to outlook message bodyOutlook 2010 VBA Task with attachmentsExcel 2016 VBA not writing to unlocked cellHow to preserve/retain hyperlinks in email body when using RangetoHTML from ExcelInsert text body and excel table body in email using VBAExcel VBA macro to send emails to unique users in rangeexcel VBA code to ignore an email attachment if missing from folder
What's the point of deactivating Num Lock on login screens?
How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?
Dragon forelimb placement
Theorem, big Paralist and Amsart
Maximum likelihood parameters deviate from posterior distributions
Did Shadowfax go to Valinor?
How do I create uniquely male characters?
What defenses are there against being summoned by the Gate spell?
Has the BBC provided arguments for saying Brexit being cancelled is unlikely?
can i play a electric guitar through a bass amp?
Theorems that impeded progress
An academic/student plagiarism
Why Is Death Allowed In the Matrix?
Is it important to consider tone, melody, and musical form while writing a song?
Can I make popcorn with any corn?
Arthur Somervell: 1000 Exercises - Meaning of this notation
Python: next in for loop
I’m planning on buying a laser printer but concerned about the life cycle of toner in the machine
If I cast Expeditious Retreat, can I Dash as a bonus action on the same turn?
Why are electrically insulating heatsinks so rare? Is it just cost?
Is this a crack on the carbon frame?
Prove that NP is closed under karp reduction?
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
Why can't I see bouncing of a switch on an oscilloscope?
VBA to email Excel 2016 Range as JPG in body - not visible
Is there a way to crack the password on an Excel VBA Project?How to avoid using Select in Excel VBAReferring to Dynamic Named Ranges in VBAHow to add excel range as a picture to outlook message bodyOutlook 2010 VBA Task with attachmentsExcel 2016 VBA not writing to unlocked cellHow to preserve/retain hyperlinks in email body when using RangetoHTML from ExcelInsert text body and excel table body in email using VBAExcel VBA macro to send emails to unique users in rangeexcel VBA code to ignore an email attachment if missing from folder
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am using the following code to select a range in Excel 2016, convert it to JPG and insert into body of email, sending with Outlook 2016.
I am getting responses from recipients that the image is missing from the body of the email.
I have BCC'd myself on the send, and the image shows on my email when received, but testing it to my private outlook.com email has the same result of no image.
Can anyone advise on the issue and rectification?
Sub Send_Email_Store()
Dim TempFilePath As String
Dim xOutApp As Object
Dim xOutMail As Object
Dim xHTMLBody As String
Dim xRg As Range
On Error Resume Next
Set xRg = Sheets("Summary Report").Range("a1:m69")
If xRg Is Nothing Then Exit Sub
With Application
.Calculation = xlManual
.ScreenUpdating = False
.EnableEvents = False
End With
Set xOutApp = CreateObject("outlook.application")
Set xOutMail = xOutApp.CreateItem(olMailItem)
Call createJpg(ActiveSheet.Name, xRg.Address, "DashboardFile")
TempFilePath = Environ$("temp") & ""
xHTMLBody = "Hi Gav," & "<br>" & _
"Please see the following QTD Summary in your Business, up until last week."
& "<br>" & _
"If you have any questions, let me know." _
& "<br><br><br>" _
& "<img src='cid:DashboardFile.jpg'>"
With xOutMail
.Subject = "QTD Overview"
.HTMLBody = xHTMLBody
.Attachments.Add TempFilePath & "DashboardFile.jpg", olByValue, 0
.To = "gavrog@hotmail.com"
.Cc = ""
.Bcc = "me.com"
.Display
End With
End Sub
Sub createJpg(SheetName As String, xRgAddrss As String, nameFile As String)
Dim xRgPic As Range
ThisWorkbook.Activate
Worksheets(SheetName).Activate
Set xRgPic = ThisWorkbook.Worksheets("Summary Report").Range(xRgAddrss)
xRgPic.CopyPicture
With ThisWorkbook.Worksheets("Summary Report").ChartObjects.Add(xRgPic.Left,
xRgPic.Top, xRgPic.Width, xRgPic.Height)
.Activate
.Chart.Paste
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
End With
Worksheets("Summary Report").ChartObjects(Worksheets("Summary
Report").ChartObjects.Count).delete
Set xRgPic = Nothing
End Sub
excel vba
add a comment |
I am using the following code to select a range in Excel 2016, convert it to JPG and insert into body of email, sending with Outlook 2016.
I am getting responses from recipients that the image is missing from the body of the email.
I have BCC'd myself on the send, and the image shows on my email when received, but testing it to my private outlook.com email has the same result of no image.
Can anyone advise on the issue and rectification?
Sub Send_Email_Store()
Dim TempFilePath As String
Dim xOutApp As Object
Dim xOutMail As Object
Dim xHTMLBody As String
Dim xRg As Range
On Error Resume Next
Set xRg = Sheets("Summary Report").Range("a1:m69")
If xRg Is Nothing Then Exit Sub
With Application
.Calculation = xlManual
.ScreenUpdating = False
.EnableEvents = False
End With
Set xOutApp = CreateObject("outlook.application")
Set xOutMail = xOutApp.CreateItem(olMailItem)
Call createJpg(ActiveSheet.Name, xRg.Address, "DashboardFile")
TempFilePath = Environ$("temp") & ""
xHTMLBody = "Hi Gav," & "<br>" & _
"Please see the following QTD Summary in your Business, up until last week."
& "<br>" & _
"If you have any questions, let me know." _
& "<br><br><br>" _
& "<img src='cid:DashboardFile.jpg'>"
With xOutMail
.Subject = "QTD Overview"
.HTMLBody = xHTMLBody
.Attachments.Add TempFilePath & "DashboardFile.jpg", olByValue, 0
.To = "gavrog@hotmail.com"
.Cc = ""
.Bcc = "me.com"
.Display
End With
End Sub
Sub createJpg(SheetName As String, xRgAddrss As String, nameFile As String)
Dim xRgPic As Range
ThisWorkbook.Activate
Worksheets(SheetName).Activate
Set xRgPic = ThisWorkbook.Worksheets("Summary Report").Range(xRgAddrss)
xRgPic.CopyPicture
With ThisWorkbook.Worksheets("Summary Report").ChartObjects.Add(xRgPic.Left,
xRgPic.Top, xRgPic.Width, xRgPic.Height)
.Activate
.Chart.Paste
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
End With
Worksheets("Summary Report").ChartObjects(Worksheets("Summary
Report").ChartObjects.Count).delete
Set xRgPic = Nothing
End Sub
excel vba
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
should be.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
SimilarlyTempFilePath = Environ$("temp") & ""
should beTempFilePath = Environ$("temp") & ""
Also if you are latebinding with outlook then I hope you have you have declaredolByValue
with a value of1
somewhere?
– Siddharth Rout
Mar 8 at 6:42
add a comment |
I am using the following code to select a range in Excel 2016, convert it to JPG and insert into body of email, sending with Outlook 2016.
I am getting responses from recipients that the image is missing from the body of the email.
I have BCC'd myself on the send, and the image shows on my email when received, but testing it to my private outlook.com email has the same result of no image.
Can anyone advise on the issue and rectification?
Sub Send_Email_Store()
Dim TempFilePath As String
Dim xOutApp As Object
Dim xOutMail As Object
Dim xHTMLBody As String
Dim xRg As Range
On Error Resume Next
Set xRg = Sheets("Summary Report").Range("a1:m69")
If xRg Is Nothing Then Exit Sub
With Application
.Calculation = xlManual
.ScreenUpdating = False
.EnableEvents = False
End With
Set xOutApp = CreateObject("outlook.application")
Set xOutMail = xOutApp.CreateItem(olMailItem)
Call createJpg(ActiveSheet.Name, xRg.Address, "DashboardFile")
TempFilePath = Environ$("temp") & ""
xHTMLBody = "Hi Gav," & "<br>" & _
"Please see the following QTD Summary in your Business, up until last week."
& "<br>" & _
"If you have any questions, let me know." _
& "<br><br><br>" _
& "<img src='cid:DashboardFile.jpg'>"
With xOutMail
.Subject = "QTD Overview"
.HTMLBody = xHTMLBody
.Attachments.Add TempFilePath & "DashboardFile.jpg", olByValue, 0
.To = "gavrog@hotmail.com"
.Cc = ""
.Bcc = "me.com"
.Display
End With
End Sub
Sub createJpg(SheetName As String, xRgAddrss As String, nameFile As String)
Dim xRgPic As Range
ThisWorkbook.Activate
Worksheets(SheetName).Activate
Set xRgPic = ThisWorkbook.Worksheets("Summary Report").Range(xRgAddrss)
xRgPic.CopyPicture
With ThisWorkbook.Worksheets("Summary Report").ChartObjects.Add(xRgPic.Left,
xRgPic.Top, xRgPic.Width, xRgPic.Height)
.Activate
.Chart.Paste
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
End With
Worksheets("Summary Report").ChartObjects(Worksheets("Summary
Report").ChartObjects.Count).delete
Set xRgPic = Nothing
End Sub
excel vba
I am using the following code to select a range in Excel 2016, convert it to JPG and insert into body of email, sending with Outlook 2016.
I am getting responses from recipients that the image is missing from the body of the email.
I have BCC'd myself on the send, and the image shows on my email when received, but testing it to my private outlook.com email has the same result of no image.
Can anyone advise on the issue and rectification?
Sub Send_Email_Store()
Dim TempFilePath As String
Dim xOutApp As Object
Dim xOutMail As Object
Dim xHTMLBody As String
Dim xRg As Range
On Error Resume Next
Set xRg = Sheets("Summary Report").Range("a1:m69")
If xRg Is Nothing Then Exit Sub
With Application
.Calculation = xlManual
.ScreenUpdating = False
.EnableEvents = False
End With
Set xOutApp = CreateObject("outlook.application")
Set xOutMail = xOutApp.CreateItem(olMailItem)
Call createJpg(ActiveSheet.Name, xRg.Address, "DashboardFile")
TempFilePath = Environ$("temp") & ""
xHTMLBody = "Hi Gav," & "<br>" & _
"Please see the following QTD Summary in your Business, up until last week."
& "<br>" & _
"If you have any questions, let me know." _
& "<br><br><br>" _
& "<img src='cid:DashboardFile.jpg'>"
With xOutMail
.Subject = "QTD Overview"
.HTMLBody = xHTMLBody
.Attachments.Add TempFilePath & "DashboardFile.jpg", olByValue, 0
.To = "gavrog@hotmail.com"
.Cc = ""
.Bcc = "me.com"
.Display
End With
End Sub
Sub createJpg(SheetName As String, xRgAddrss As String, nameFile As String)
Dim xRgPic As Range
ThisWorkbook.Activate
Worksheets(SheetName).Activate
Set xRgPic = ThisWorkbook.Worksheets("Summary Report").Range(xRgAddrss)
xRgPic.CopyPicture
With ThisWorkbook.Worksheets("Summary Report").ChartObjects.Add(xRgPic.Left,
xRgPic.Top, xRgPic.Width, xRgPic.Height)
.Activate
.Chart.Paste
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
End With
Worksheets("Summary Report").ChartObjects(Worksheets("Summary
Report").ChartObjects.Count).delete
Set xRgPic = Nothing
End Sub
excel vba
excel vba
edited Mar 8 at 4:19
Mathieu Guindon
44.6k770156
44.6k770156
asked Mar 8 at 4:15
DougDoug
1
1
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
should be.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
SimilarlyTempFilePath = Environ$("temp") & ""
should beTempFilePath = Environ$("temp") & ""
Also if you are latebinding with outlook then I hope you have you have declaredolByValue
with a value of1
somewhere?
– Siddharth Rout
Mar 8 at 6:42
add a comment |
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
should be.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
SimilarlyTempFilePath = Environ$("temp") & ""
should beTempFilePath = Environ$("temp") & ""
Also if you are latebinding with outlook then I hope you have you have declaredolByValue
with a value of1
somewhere?
– Siddharth Rout
Mar 8 at 6:42
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
should be .Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
Similarly TempFilePath = Environ$("temp") & ""
should be TempFilePath = Environ$("temp") & ""
Also if you are latebinding with outlook then I hope you have you have declared olByValue
with a value of 1
somewhere?– Siddharth Rout
Mar 8 at 6:42
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
should be .Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
Similarly TempFilePath = Environ$("temp") & ""
should be TempFilePath = Environ$("temp") & ""
Also if you are latebinding with outlook then I hope you have you have declared olByValue
with a value of 1
somewhere?– Siddharth Rout
Mar 8 at 6:42
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056638%2fvba-to-email-excel-2016-range-as-jpg-in-body-not-visible%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55056638%2fvba-to-email-excel-2016-range-as-jpg-in-body-not-visible%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
should be.Chart.Export Environ$("temp") & "" & nameFile & ".jpg", "JPG"
SimilarlyTempFilePath = Environ$("temp") & ""
should beTempFilePath = Environ$("temp") & ""
Also if you are latebinding with outlook then I hope you have you have declaredolByValue
with a value of1
somewhere?– Siddharth Rout
Mar 8 at 6:42