Insert standard text into a new message

G

Gabe

Hello,

I am pretty new at this but, how do you insert standard text into a new
e-mail message without deleting the default signature? I am using the
following code:


Sub Macro1()
Set OutLk = CreateObject("Outlook.Application")
Set Email = OutLk.CreateItem(0)
With Email
..To = "(e-mail address removed)"
..Subject = "New Message"
..Body = "Hello?"
..Display
End With
Set Email = Nothing
Set OutLk = Nothing
End Sub
 
G

Gabe

No, a message box came up that said (A program is trying to access e-mail
addresses you have stored in Outlook. Do you want tp allow this?

If this is unexpected, it may be a virus and you should choose "No".)

So when I click on No it does nothing, when I click on Yes it works but the
signature is still deleted?

Any alternatives to this problem?
 
G

Gabe

Sorry about that I am running 2003, I tried all the code in that link but it
doesn't seem to work? Also, is there a way to set a default SigName? Because
I am not the only one who will be using this code...

I am really kinda of new at all this, thank you so much for your help.
 
J

JP

This code worked for me. I put this code in a standard Outlook module.
You mentioned the security prompt, if you are using this in Outlook
that won't happen. Unfortunately the code changes the formatting of
the signature, a small price to pay.


Sub Macro1()

Dim olApp As Outlook.Application
Dim olMsg As Outlook.MailItem

Set olApp = Outlook.Application
Set olMsg = olApp.CreateItem(olMailItem)

With olMsg
.To = "(e-mail address removed)"
.Subject = "Hello world"
.Display
.Body = "Hello, here is my email!" & .Body
End With

Set olMsg = Nothing
Set olApp = Nothing
End Sub


HTH,
JP
 
G

Gabe

Yes! that did it! your a genius! Thanks a bunch!

JP said:
This code worked for me. I put this code in a standard Outlook module.
You mentioned the security prompt, if you are using this in Outlook
that won't happen. Unfortunately the code changes the formatting of
the signature, a small price to pay.


Sub Macro1()

Dim olApp As Outlook.Application
Dim olMsg As Outlook.MailItem

Set olApp = Outlook.Application
Set olMsg = olApp.CreateItem(olMailItem)

With olMsg
.To = "(e-mail address removed)"
.Subject = "Hello world"
.Display
.Body = "Hello, here is my email!" & .Body
End With

Set olMsg = Nothing
Set olApp = Nothing
End Sub


HTH,
JP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top