Email body and signature help

Status
Not open for further replies.
J

joave

Hi:

I am attempting to insert specific text into the body of an HTML message

using Word as the editor with VBA. However, when I change the body of the

message, my signature disappears. Can someone please tell me how to keep the

signature in the message while inserting additional text? I have tried

several different methods but none seem to work.

Here is my current code (with some failed attempts at the above goal):

Dim objOLApp As Outlook.Application

Dim NewMail As Outlook.MailItem

Set objOLApp = New Outlook.Application

Set NewMail = objOLApp.CreateItem(olMailItem)

NewMail.Display

NewMail.To = "CF Reports"

NewMail.Subject = "Report " & Date - 1

Dim Temp As String

Temp = "Hi Team, </br>" & vbCrLf & vbCrLf & " Here is the latest Report.

Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thank

you,"

Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody

NewMail.HTMLBody = Temp

'NewMail.Body = Temp

Thank you in advance,

Dave
 
S

Sue Mosher [MVP]

Call the message's Display method, get the HTMLBody (which will have the

signature at that point), and modify HTMLBody to include your new text. If

you know what the signature looks like, it may be easiest to use the

Replace() function to find the beginning of the signature and replace it

with your_new_text+beginning_of_signature.

Sue Mosher

"joave" <joave> wrote in message

news:97169C74-4654-48B1-A135-4BE2BC512494@microsoft.com...
> Hi:

> I am attempting to insert specific text into the body of an HTML message
> using Word as the editor with VBA. However, when I change the body of the
> message, my signature disappears. Can someone please tell me how to keep
> the
> signature in the message while inserting additional text? I have tried
> several different methods but none seem to work.

> Here is my current code (with some failed attempts at the above goal):

> Dim objOLApp As Outlook.Application
> Dim NewMail As Outlook.MailItem
> Set objOLApp = New Outlook.Application
> Set NewMail = objOLApp.CreateItem(olMailItem)
> NewMail.Display
> NewMail.To = "CF Reports"
> NewMail.Subject = "Report " & Date - 1
> Dim Temp As String

> Temp = "Hi Team, </br>" & vbCrLf & vbCrLf & " Here is the latest Report.
> Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thank
> you,"
> Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody
> NewMail.HTMLBody = Temp
> 'NewMail.Body = Temp

> Thank you in advance,

> Dave
 
J

joave

Hi Sue,

Thank you for your reply. This is where I thought this would go (there are

never any magic answers LOL). I was hoping to be able to use the picture that

is in my signature without having to replace the entire body, but it looks

like that will be very difficult to do.

Thanks again,

Dave

"Sue Mosher [MVP]" wrote:


> Call the message's Display method, get the HTMLBody (which will have the
> signature at that point), and modify HTMLBody to include your new text. If
> you know what the signature looks like, it may be easiest to use the
> Replace() function to find the beginning of the signature and replace it
> with your_new_text+beginning_of_signature.

> > Sue Mosher
> > >

> "joave" <joave> wrote in message
> news:97169C74-4654-48B1-A135-4BE2BC512494@microsoft.com...
> > Hi:
> > I am attempting to insert specific text into the body of an HTML message
> > using Word as the editor with VBA. However, when I change the body of the
> > message, my signature disappears. Can someone please tell me how to keep
> > the
> > signature in the message while inserting additional text? I have tried
> > several different methods but none seem to work.
> > Here is my current code (with some failed attempts at the above goal):
> > Dim objOLApp As Outlook.Application
> > Dim NewMail As Outlook.MailItem
> > Set objOLApp = New Outlook.Application
> > Set NewMail = objOLApp.CreateItem(olMailItem)
> > NewMail.Display
> > NewMail.To = "CF Reports"
> > NewMail.Subject = "Report " & Date - 1
> > Dim Temp As String
> > Temp = "Hi Team, </br>" & vbCrLf & vbCrLf & " Here is the latest Report.
> > Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thank
> > you,"
> > Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody
> > NewMail.HTMLBody = Temp
> > 'NewMail.Body = Temp
> > Thank you in advance,
> > Dave


>
 
C

Curt

Can you direct me as to getting a picture into a signature macro in Outlook

2000 useing XP. Have done macros in excel but outlook is not same. Copying

excel does not work. Am not sure where to start. Macro would then contain

signature & picture when inserting into outgoing mail

Thanks

"Sue Mosher [MVP]" wrote:


> Call the message's Display method, get the HTMLBody (which will have the
> signature at that point), and modify HTMLBody to include your new text. If
> you know what the signature looks like, it may be easiest to use the
> Replace() function to find the beginning of the signature and replace it
> with your_new_text+beginning_of_signature.

> > Sue Mosher
> > >

> "joave" <joave> wrote in message
> news:97169C74-4654-48B1-A135-4BE2BC512494@microsoft.com...
> > Hi:
> > I am attempting to insert specific text into the body of an HTML message
> > using Word as the editor with VBA. However, when I change the body of the
> > message, my signature disappears. Can someone please tell me how to keep
> > the
> > signature in the message while inserting additional text? I have tried
> > several different methods but none seem to work.
> > Here is my current code (with some failed attempts at the above goal):
> > Dim objOLApp As Outlook.Application
> > Dim NewMail As Outlook.MailItem
> > Set objOLApp = New Outlook.Application
> > Set NewMail = objOLApp.CreateItem(olMailItem)
> > NewMail.Display
> > NewMail.To = "CF Reports"
> > NewMail.Subject = "Report " & Date - 1
> > Dim Temp As String
> > Temp = "Hi Team, </br>" & vbCrLf & vbCrLf & " Here is the latest Report.
> > Please let me know if you have any questions." & vbCrLf & vbCrLf & "Thank
> > you,"
> > Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody
> > NewMail.HTMLBody = Temp
> > 'NewMail.Body = Temp
> > Thank you in advance,
> > Dave


>
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
If you want to send the image with the email, you need to embed it. This

example demonstrartes how to do that:

http://www.vboffice.net/en/developers/embed-pictures-in-email

Best regards

Michael Bauer

Am Sun, 27 Dec 2009 22:03:01 -0800 schrieb Curt:


> Can you direct me as to getting a picture into a signature macro in


Outlook
> 2000 useing XP. Have done macros in excel but outlook is not same. Copying
> excel does not work. Am not sure where to start. Macro would then contain
> signature & picture when inserting into outgoing mail
> Thanks

> "Sue Mosher [MVP]" wrote:
>
> > Call the message's Display method, get the HTMLBody (which will have the
> > signature at that point), and modify HTMLBody to include your new text.


If
> > you know what the signature looks like, it may be easiest to use the
> > Replace() function to find the beginning of the signature and replace it
> > with your_new_text+beginning_of_signature.
>

>> > > Sue Mosher
> > >> >> >
>
>> "joave" <joave> wrote in message
> > news:97169C74-4654-48B1-A135-4BE2BC512494@microsoft.com...
> >> Hi:
> >
>>> I am attempting to insert specific text into the body of an HTML


message
> >> using Word as the editor with VBA. However, when I change the body of


the
> >> message, my signature disappears. Can someone please tell me how to keep
> >> the
> >> signature in the message while inserting additional text? I have tried
> >> several different methods but none seem to work.
> >
>>> Here is my current code (with some failed attempts at the above goal):
> >
>>> Dim objOLApp As Outlook.Application
> >> Dim NewMail As Outlook.MailItem
> >> Set objOLApp = New Outlook.Application
> >> Set NewMail = objOLApp.CreateItem(olMailItem)
> >> NewMail.Display
> >> NewMail.To = "CF Reports"
> >> NewMail.Subject = "Report " & Date - 1
> >> Dim Temp As String
> >
>>> Temp = "Hi Team, </br>" & vbCrLf & vbCrLf & " Here is the latest


Report.
> >> Please let me know if you have any questions." & vbCrLf & vbCrLf &


"Thank
> >> you,"
> >> Temp = Temp & vbCrLf & vbCrLf & "David " & NewMail.HTMLBody
> >> NewMail.HTMLBody = Temp
> >> 'NewMail.Body = Temp
> >
>>> Thank you in advance,
> >
>>> Dave

>

>
>>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J Outlook 2019 Regex email addresses from body Outlook VBA and Custom Forms 6
Z Copy specific email body text Outlook VBA and Custom Forms 0
J How do you disable address search box when typing @ in body of email? Using Outlook 0
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 22
G Place jpg in body of email Outlook VBA and Custom Forms 1
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
G Forward email body to other mail list directly from Exchange server Exchange Server Administration 1
D auto forward base on email address in body email Outlook VBA and Custom Forms 0
Z Add ComboBox Value to Body of Email Outlook VBA and Custom Forms 1
J Autoreply email recieved from specific sender after deleting some text from body. Using Outlook 0
S Body text of Email from invite date/time Outlook VBA and Custom Forms 7
O Forward a email with modified body Automatically. Outlook VBA and Custom Forms 0
P Insert link in email body to attached document in Outlook 365 Outlook VBA and Custom Forms 0
J VBA Outlook : Subject line : Cut and Paste name to heading , number to very end of the body of Email Outlook VBA and Custom Forms 1
D Body text of email disappears when I scan an attachment from printer to email Using Outlook 1
M Adding Macro to populate "to" "subject" "body" not deleting email string below. Outlook VBA and Custom Forms 5
Sabastian Samuel HOW DO I FORWARD AN EMAIL WITH MACRO using an email that in the body of another email Outlook VBA and Custom Forms 3
D Keep Original html body when forwarding an email Outlook VBA and Custom Forms 7
C Transfer Outlook TextBox Text Into Email Body Outlook VBA and Custom Forms 2
A Forwarding email and replacing body Outlook VBA and Custom Forms 1
K ind specific Subject line from outlook and copy the content of the email body to exce Outlook VBA and Custom Forms 0
M Want to autorespond to an email address in the body of message Using Outlook 0
K Extract email address from body and auto-reply outlook Using Outlook 1
D VBA to edit body of incoming email and forwarding it Outlook VBA and Custom Forms 11
O VBA to extract email (fields and body) to Excel Outlook VBA and Custom Forms 14
A Create Macro for hyperlink(email) in message body Outlook VBA and Custom Forms 9
L Copy email body fields to excel Using Outlook 0
J Pull an email address from body and replace reply-to address Outlook VBA and Custom Forms 4
divan Outlook 2007 - Replace email body with custom text Using Outlook 9
E Button in body of email to approve/reject with original text Using Outlook 1
B Extract Dates for Appointment Item in Body of email Outlook VBA and Custom Forms 10
M Sending Excel Charts in the Body of an Email Using Outlook 1
B Need Help Creating Email Based on Subject w Address in Body Outlook VBA and Custom Forms 1
E Automatically pick up Recipient's Name on the Body of the Email Message Using Outlook 1
A Create Task from Email and put body & email as attachment into task notes Outlook VBA and Custom Forms 17
Aussie Looking for Outlook macro to Copy Recipient Names into Email Body Outlook VBA and Custom Forms 3
A Macro to copy email body to new email Outlook VBA and Custom Forms 5
R Body of email not visible in Outlook Data File Sent Folder Using Outlook 4
S Pre populate subject + body + attachment to already open email in outlook 2007 Using Outlook 2
G Create rule based on image in email body Using Outlook 1
F Script needed for replying to email address in body of receiving email Using Outlook 46
S email body without "HYPERLINK" ( vba ) Using Outlook 6
I can't view email body please help! Using Outlook 6
D Email addresss in body of email with single quote Using Outlook 3
M rule to change subject, pull email addresses from body, and forward with templ Using Outlook 14
L Script to: Change subject of email after checking body Using Outlook 2
H Extract emails from Outlokk 2007 email body Using Outlook 0
L Forward Email and Insert Sender's Email address in body Outlook VBA and Custom Forms 3
S HELP: Email body transcript deleted when receiving response emails Outlook VBA and Custom Forms 1
T Can not change email body content on Outlook 2010 Outlook VBA and Custom Forms 2

Similar threads

Top