Godster
03-27-2012, 10:32 PM
Hi,
I am after the code to put in an Outlook Macro to delete the confidentiality message at the end of my email signature.
(I am a self-'taught' beginner at VBA).
Reason: I need the signature to default with the confidentiality message as it must accompany all external emails, but when communicating internally the message is not required. So every internal email, I'm scrolling down to the deletable text and deleting it. V frustrating.
My solution (since you don't seem to be able to record a macro when in an open email) was to copy my Signature into a word doc. Start the recorder and carry out the procedure there.
step1: cntrl-home to top of doc
2: cntrl-f to open the find window
3: type in the text from the opening of the confidentiality waiver. Find next.
4: esc out of the find window
5: cntrl-shift-down to select all the text requiring deletion
6: delete
7: cntrl-home to get back to the top of the page.
As a macro works fine in Word. Not so in Outlook.
I would like this to work only in the current, ie open, email.
Here's the code as copied from Word:
Sub DelConf2()
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "This email is confidential and intended solely for the use"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory
End Sub
I then copied that VBA into the email macro VBA editor.
All help appreciated, and it's safest to assume I know nothing (because I really do know next to nothing!)
I'm sure you can all see why that won't work. But I don't know enough to know what tweaks are required.
I am after the code to put in an Outlook Macro to delete the confidentiality message at the end of my email signature.
(I am a self-'taught' beginner at VBA).
Reason: I need the signature to default with the confidentiality message as it must accompany all external emails, but when communicating internally the message is not required. So every internal email, I'm scrolling down to the deletable text and deleting it. V frustrating.
My solution (since you don't seem to be able to record a macro when in an open email) was to copy my Signature into a word doc. Start the recorder and carry out the procedure there.
step1: cntrl-home to top of doc
2: cntrl-f to open the find window
3: type in the text from the opening of the confidentiality waiver. Find next.
4: esc out of the find window
5: cntrl-shift-down to select all the text requiring deletion
6: delete
7: cntrl-home to get back to the top of the page.
As a macro works fine in Word. Not so in Outlook.
I would like this to work only in the current, ie open, email.
Here's the code as copied from Word:
Sub DelConf2()
'
Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
With Selection.Find
.Text = "This email is confidential and intended solely for the use"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.HomeKey Unit:=wdStory
End Sub
I then copied that VBA into the email macro VBA editor.
All help appreciated, and it's safest to assume I know nothing (because I really do know next to nothing!)
I'm sure you can all see why that won't work. But I don't know enough to know what tweaks are required.