Obtain Outlook Signature in Email

C

Curtis Guy

I have a signature stored in Outlook that is automatically inserted when I
create a new email.

I have created a VBScript to generate an email and would like to insert that
same signature, or possibly a different one, into the email. I have
searched in vain for a method of accessing the signatures from a script.

I am currently inserting a "signature" as part of the message text, but want
to make this script available so that anyone can use it and have their
signature inserted.

Can someone help me on this? I have included a sample of the script I have
written.

Thanks.


Sample script follows:
<?xml version="1.0"?>
<?job error="true" debug="true"?>
<!--
Create email
-->

<job>
<reference object="Outlook.Application" />
<script language="VBScript">
<![CDATA[

' Force all variables to be defined
Option Explicit

Dim OlApp, Recip, Message, Attachment, blankLine
Dim sigLine, sigLine01, sigLine02, sigLine03, sigLine04, sigLine05
Dim sigLine06, sigLine07, sigLine08, sigLine09, sigLine10, sigLine11
Dim msgLine01, msgLine02, sig

' Setup blank line
blankLine = " " + vbCrLf

' Setup signature lines
sigLine01 = "Signatrue line 1" + vbCrLf
sigLine02 = "Signature line 2" + vbCrLf
sigLine = sigLine01 & blankLine & sigLine02

' Create the Outlook application object.
Set OlApp = CreateObject("Outlook.Application")

' Create the email
Set Message = OlApp.CreateItem(olMailItem)
Message.Subject = "Test Email"
msgLine01 = "This is a test email with a signature line added." + vbCrLf
Message.Body = msgLine01 & blankLine & blankLine & sigLine

' Add and resolve recipients.
Set Recip = Message.Recipients.Add("(e-mail address removed)")

Message.Save

' Release the message object
Set Message = Nothing

' Quit the script
WScript.Quit
]]>
</script>
</job>
 
C

Curtis Guy

Thanks for the info.


Sue Mosher said:
The sample code at http://www.outlookcode.com/codedetail.aspx?id=615 is
for VBA, but could easily be adapted to VBScript. The main problem with
your method below is that it doesn't take into the possibility of
different message formats.

--
Sue Mosher, Outlook MVP
Author of
Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers



Curtis Guy said:
I have a signature stored in Outlook that is automatically inserted when I
create a new email.

I have created a VBScript to generate an email and would like to insert
that
same signature, or possibly a different one, into the email. I have
searched in vain for a method of accessing the signatures from a script.

I am currently inserting a "signature" as part of the message text, but
want
to make this script available so that anyone can use it and have their
signature inserted.

Can someone help me on this? I have included a sample of the script I
have
written.

Thanks.


Sample script follows:
<?xml version="1.0"?>
<?job error="true" debug="true"?>
<!--
Create email
-->

<job>
<reference object="Outlook.Application" />
<script language="VBScript">
<![CDATA[

' Force all variables to be defined
Option Explicit

Dim OlApp, Recip, Message, Attachment, blankLine
Dim sigLine, sigLine01, sigLine02, sigLine03, sigLine04, sigLine05
Dim sigLine06, sigLine07, sigLine08, sigLine09, sigLine10, sigLine11
Dim msgLine01, msgLine02, sig

' Setup blank line
blankLine = " " + vbCrLf

' Setup signature lines
sigLine01 = "Signatrue line 1" + vbCrLf
sigLine02 = "Signature line 2" + vbCrLf
sigLine = sigLine01 & blankLine & sigLine02

' Create the Outlook application object.
Set OlApp = CreateObject("Outlook.Application")

' Create the email
Set Message = OlApp.CreateItem(olMailItem)
Message.Subject = "Test Email"
msgLine01 = "This is a test email with a signature line added." + vbCrLf
Message.Body = msgLine01 & blankLine & blankLine & sigLine

' Add and resolve recipients.
Set Recip = Message.Recipients.Add("(e-mail address removed)")

Message.Save

' Release the message object
Set Message = Nothing

' Quit the script
WScript.Quit
]]>
</script>
</job>
 

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