Excel VBA delete email after sending
might be you are able to help me with VBA code.
I got a code that send as PDF part of excel sheet.
Problem is that email is used by many people and sometimes text is confidential. Is there an option to delete email (sent items and deleted items) after email is sent?
Using office 2000
Here is my existing code.
Sub SendDDocs()
Dim IsCreated As Boolean
Dim PdfFile As String, Title As String
Dim OutlApp As Object
Dim rng As Range
Set rng = Range("A1:J103")
Title = Range("o1")
Title = Range("o1").Value & " Confidetial"
PdfFile = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "" & Title & ".pdf"
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
On Error Resume Next
Set OutlApp = GetObject(, "Outlook.Application")
If Err Then
Set OutlApp = CreateObject("Outlook.Application")
IsCreated = True
End If
OutlApp.Visible = True
On Error GoTo 0
With OutlApp.CreateItem(0)
.Subject = Title
.To = "email@email.com"
.CC = "email@email.com"
.Body = "" & vbLf & vbLf _
& "a" & vbLf & vbLf _
& "" & vbLf _
& Application.UserName & vbLf & vbLf
.Attachments.Add PdfFile
Application.Visible = True
.Display
End With
Kill PdfFile
If IsCreated Then OutlApp.Quit
Set OutlApp = Nothing
End Sub
excel vba outlook
|
show 5 more comments
might be you are able to help me with VBA code.
I got a code that send as PDF part of excel sheet.
Problem is that email is used by many people and sometimes text is confidential. Is there an option to delete email (sent items and deleted items) after email is sent?
Using office 2000
Here is my existing code.
Sub SendDDocs()
Dim IsCreated As Boolean
Dim PdfFile As String, Title As String
Dim OutlApp As Object
Dim rng As Range
Set rng = Range("A1:J103")
Title = Range("o1")
Title = Range("o1").Value & " Confidetial"
PdfFile = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "" & Title & ".pdf"
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
On Error Resume Next
Set OutlApp = GetObject(, "Outlook.Application")
If Err Then
Set OutlApp = CreateObject("Outlook.Application")
IsCreated = True
End If
OutlApp.Visible = True
On Error GoTo 0
With OutlApp.CreateItem(0)
.Subject = Title
.To = "email@email.com"
.CC = "email@email.com"
.Body = "" & vbLf & vbLf _
& "a" & vbLf & vbLf _
& "" & vbLf _
& Application.UserName & vbLf & vbLf
.Attachments.Add PdfFile
Application.Visible = True
.Display
End With
Kill PdfFile
If IsCreated Then OutlApp.Quit
Set OutlApp = Nothing
End Sub
excel vba outlook
1
You are talking about confidential data sent with an unencrypted email "Using office 2000" Are you serious? This Office version is out of security updates since almost 10 years. You should consider an upgrade for security reasons. • And you should consider not transferring confidential data through unsecured channels.
– Pᴇʜ
Nov 14 '18 at 8:38
Yes I am talking about that. Unfortunately got no option to update version at the moment. As company will change software just in 2020. Sent data is not a big secret. So, I believe just delete from email would be enough, I hope so :)
– qop
Nov 14 '18 at 8:40
Actually your biggest security issue is the person who decided to "change software just in 2020" • Nevertheless the email is not sent with your code but just displayed see.Display
. If you change it to.Send
you can.Delete
it after it was sent.
– Pᴇʜ
Nov 14 '18 at 9:15
Yes, firstly Outlook show email and Send button is clicked manually. It is done in purpose to avoid not sent email (had experience with that)
– qop
Nov 14 '18 at 9:28
The email can only automatically be deleted if it is sent automatically. If the user sends it manually he is responsible of his confidential data and must delete it himself.
– Pᴇʜ
Nov 14 '18 at 9:39
|
show 5 more comments
might be you are able to help me with VBA code.
I got a code that send as PDF part of excel sheet.
Problem is that email is used by many people and sometimes text is confidential. Is there an option to delete email (sent items and deleted items) after email is sent?
Using office 2000
Here is my existing code.
Sub SendDDocs()
Dim IsCreated As Boolean
Dim PdfFile As String, Title As String
Dim OutlApp As Object
Dim rng As Range
Set rng = Range("A1:J103")
Title = Range("o1")
Title = Range("o1").Value & " Confidetial"
PdfFile = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "" & Title & ".pdf"
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
On Error Resume Next
Set OutlApp = GetObject(, "Outlook.Application")
If Err Then
Set OutlApp = CreateObject("Outlook.Application")
IsCreated = True
End If
OutlApp.Visible = True
On Error GoTo 0
With OutlApp.CreateItem(0)
.Subject = Title
.To = "email@email.com"
.CC = "email@email.com"
.Body = "" & vbLf & vbLf _
& "a" & vbLf & vbLf _
& "" & vbLf _
& Application.UserName & vbLf & vbLf
.Attachments.Add PdfFile
Application.Visible = True
.Display
End With
Kill PdfFile
If IsCreated Then OutlApp.Quit
Set OutlApp = Nothing
End Sub
excel vba outlook
might be you are able to help me with VBA code.
I got a code that send as PDF part of excel sheet.
Problem is that email is used by many people and sometimes text is confidential. Is there an option to delete email (sent items and deleted items) after email is sent?
Using office 2000
Here is my existing code.
Sub SendDDocs()
Dim IsCreated As Boolean
Dim PdfFile As String, Title As String
Dim OutlApp As Object
Dim rng As Range
Set rng = Range("A1:J103")
Title = Range("o1")
Title = Range("o1").Value & " Confidetial"
PdfFile = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "" & Title & ".pdf"
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
On Error Resume Next
Set OutlApp = GetObject(, "Outlook.Application")
If Err Then
Set OutlApp = CreateObject("Outlook.Application")
IsCreated = True
End If
OutlApp.Visible = True
On Error GoTo 0
With OutlApp.CreateItem(0)
.Subject = Title
.To = "email@email.com"
.CC = "email@email.com"
.Body = "" & vbLf & vbLf _
& "a" & vbLf & vbLf _
& "" & vbLf _
& Application.UserName & vbLf & vbLf
.Attachments.Add PdfFile
Application.Visible = True
.Display
End With
Kill PdfFile
If IsCreated Then OutlApp.Quit
Set OutlApp = Nothing
End Sub
excel vba outlook
excel vba outlook
edited Nov 14 '18 at 8:29
Pᴇʜ
23.6k62951
23.6k62951
asked Nov 14 '18 at 8:20
qopqop
1
1
1
You are talking about confidential data sent with an unencrypted email "Using office 2000" Are you serious? This Office version is out of security updates since almost 10 years. You should consider an upgrade for security reasons. • And you should consider not transferring confidential data through unsecured channels.
– Pᴇʜ
Nov 14 '18 at 8:38
Yes I am talking about that. Unfortunately got no option to update version at the moment. As company will change software just in 2020. Sent data is not a big secret. So, I believe just delete from email would be enough, I hope so :)
– qop
Nov 14 '18 at 8:40
Actually your biggest security issue is the person who decided to "change software just in 2020" • Nevertheless the email is not sent with your code but just displayed see.Display
. If you change it to.Send
you can.Delete
it after it was sent.
– Pᴇʜ
Nov 14 '18 at 9:15
Yes, firstly Outlook show email and Send button is clicked manually. It is done in purpose to avoid not sent email (had experience with that)
– qop
Nov 14 '18 at 9:28
The email can only automatically be deleted if it is sent automatically. If the user sends it manually he is responsible of his confidential data and must delete it himself.
– Pᴇʜ
Nov 14 '18 at 9:39
|
show 5 more comments
1
You are talking about confidential data sent with an unencrypted email "Using office 2000" Are you serious? This Office version is out of security updates since almost 10 years. You should consider an upgrade for security reasons. • And you should consider not transferring confidential data through unsecured channels.
– Pᴇʜ
Nov 14 '18 at 8:38
Yes I am talking about that. Unfortunately got no option to update version at the moment. As company will change software just in 2020. Sent data is not a big secret. So, I believe just delete from email would be enough, I hope so :)
– qop
Nov 14 '18 at 8:40
Actually your biggest security issue is the person who decided to "change software just in 2020" • Nevertheless the email is not sent with your code but just displayed see.Display
. If you change it to.Send
you can.Delete
it after it was sent.
– Pᴇʜ
Nov 14 '18 at 9:15
Yes, firstly Outlook show email and Send button is clicked manually. It is done in purpose to avoid not sent email (had experience with that)
– qop
Nov 14 '18 at 9:28
The email can only automatically be deleted if it is sent automatically. If the user sends it manually he is responsible of his confidential data and must delete it himself.
– Pᴇʜ
Nov 14 '18 at 9:39
1
1
You are talking about confidential data sent with an unencrypted email "Using office 2000" Are you serious? This Office version is out of security updates since almost 10 years. You should consider an upgrade for security reasons. • And you should consider not transferring confidential data through unsecured channels.
– Pᴇʜ
Nov 14 '18 at 8:38
You are talking about confidential data sent with an unencrypted email "Using office 2000" Are you serious? This Office version is out of security updates since almost 10 years. You should consider an upgrade for security reasons. • And you should consider not transferring confidential data through unsecured channels.
– Pᴇʜ
Nov 14 '18 at 8:38
Yes I am talking about that. Unfortunately got no option to update version at the moment. As company will change software just in 2020. Sent data is not a big secret. So, I believe just delete from email would be enough, I hope so :)
– qop
Nov 14 '18 at 8:40
Yes I am talking about that. Unfortunately got no option to update version at the moment. As company will change software just in 2020. Sent data is not a big secret. So, I believe just delete from email would be enough, I hope so :)
– qop
Nov 14 '18 at 8:40
Actually your biggest security issue is the person who decided to "change software just in 2020" • Nevertheless the email is not sent with your code but just displayed see
.Display
. If you change it to .Send
you can .Delete
it after it was sent.– Pᴇʜ
Nov 14 '18 at 9:15
Actually your biggest security issue is the person who decided to "change software just in 2020" • Nevertheless the email is not sent with your code but just displayed see
.Display
. If you change it to .Send
you can .Delete
it after it was sent.– Pᴇʜ
Nov 14 '18 at 9:15
Yes, firstly Outlook show email and Send button is clicked manually. It is done in purpose to avoid not sent email (had experience with that)
– qop
Nov 14 '18 at 9:28
Yes, firstly Outlook show email and Send button is clicked manually. It is done in purpose to avoid not sent email (had experience with that)
– qop
Nov 14 '18 at 9:28
The email can only automatically be deleted if it is sent automatically. If the user sends it manually he is responsible of his confidential data and must delete it himself.
– Pᴇʜ
Nov 14 '18 at 9:39
The email can only automatically be deleted if it is sent automatically. If the user sends it manually he is responsible of his confidential data and must delete it himself.
– Pᴇʜ
Nov 14 '18 at 9:39
|
show 5 more comments
1 Answer
1
active
oldest
votes
Instead of .Display
use
.DeleteAfterSubmit = True
.Send
to not save a copy in sent items.
See MailItem.DeleteAfterSubmit Property (Outlook).
add a comment |
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%2f53295720%2fexcel-vba-delete-email-after-sending%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Instead of .Display
use
.DeleteAfterSubmit = True
.Send
to not save a copy in sent items.
See MailItem.DeleteAfterSubmit Property (Outlook).
add a comment |
Instead of .Display
use
.DeleteAfterSubmit = True
.Send
to not save a copy in sent items.
See MailItem.DeleteAfterSubmit Property (Outlook).
add a comment |
Instead of .Display
use
.DeleteAfterSubmit = True
.Send
to not save a copy in sent items.
See MailItem.DeleteAfterSubmit Property (Outlook).
Instead of .Display
use
.DeleteAfterSubmit = True
.Send
to not save a copy in sent items.
See MailItem.DeleteAfterSubmit Property (Outlook).
answered Nov 14 '18 at 14:06
PᴇʜPᴇʜ
23.6k62951
23.6k62951
add a comment |
add a comment |
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%2f53295720%2fexcel-vba-delete-email-after-sending%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
1
You are talking about confidential data sent with an unencrypted email "Using office 2000" Are you serious? This Office version is out of security updates since almost 10 years. You should consider an upgrade for security reasons. • And you should consider not transferring confidential data through unsecured channels.
– Pᴇʜ
Nov 14 '18 at 8:38
Yes I am talking about that. Unfortunately got no option to update version at the moment. As company will change software just in 2020. Sent data is not a big secret. So, I believe just delete from email would be enough, I hope so :)
– qop
Nov 14 '18 at 8:40
Actually your biggest security issue is the person who decided to "change software just in 2020" • Nevertheless the email is not sent with your code but just displayed see
.Display
. If you change it to.Send
you can.Delete
it after it was sent.– Pᴇʜ
Nov 14 '18 at 9:15
Yes, firstly Outlook show email and Send button is clicked manually. It is done in purpose to avoid not sent email (had experience with that)
– qop
Nov 14 '18 at 9:28
The email can only automatically be deleted if it is sent automatically. If the user sends it manually he is responsible of his confidential data and must delete it himself.
– Pᴇʜ
Nov 14 '18 at 9:39