Re: VBScript Signature in Outlook from TechNet Magazine?

Tech-Archive recommends: Speed Up your PC by fixing your registry



<br> would never work in a Word document because it means text, not an HTML tag, to the Word object model.

Running the Word macro recorder for the time it takes to type a line, a line break, and another line suggests that Chr(11) is what you're looking for.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"benb" <benblackmore@xxxxxxxxxxxxxxxx> wrote in message news:udZSWyU4GHA.1196@xxxxxxxxxxxxxxxxxxxxxxx
Hi Sue,

vbCR & TypeParagraph work fine if the email is written in plain or rich
text, however in HTML it always returns a new full new paragraph. I guess I
could use '<br>', at the end of each line for HTML, but then if the user
doesn't have HTML set as default, wouldn't it end up inserting <br> as text,
so I'd end up with "John Doe<br>Manager<br>IT Department<br>".
I need something that will give a line feed in plain text, rich text or
html, or maybe I could force everyone to use either Rich text, or HTML,
possibly add a section to the script, to set the outlook default!?

Thanks

Ben


"Sue Mosher [MVP-Outlook]" <suemvp@xxxxxxxxxxxxxxx> wrote in message
news:eike9mL4GHA.4924@xxxxxxxxxxxxxxxxxxxxxxx
You should be able to just build one string and use vbCR wherever you want a
line break, then insert it with one TypeText statement.

"benb" <benblackmore@xxxxxxxxxxxxxxxx> wrote in message
news:e9pOWSL4GHA.1256@xxxxxxxxxxxxxxxxxxxxxxx
Hi Sue,

That worked great, thank you!

I've managed to get it to pull additional info like email address, and
mobile number, and add formatting using objSelection.Font.Name = "Arial" &
objSelection.Font.Size = "10".
However, I was wondering if you knew of a way to insert just a line break,
rather than a whole new paragraph? The trouble is that using
"objSelection.TypeParagraph" the signature comes out with:

===============
Joe Bloggs

IT Department

My Company

Tel: (1234) 123456
==================
I'd like to format it like this:
==================
Joe Bloggs
IT Department
My Company
Tel: (1234) 123456
==================

Thanks for you're help.

Ben

"Sue Mosher [MVP-Outlook]" <suemvp@xxxxxxxxxxxxxxx> wrote in message
news:eMtSsvJ4GHA.1300@xxxxxxxxxxxxxxxxxxxxxxx
The script doesn't need to be set up in Outlook. As designed, it needs to
be
run once, as from a login script. It seems to have a few errors, though.
Try
this version instead:

On Error Resume Next

Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://"; & strUser)

strName = objUser.FullName
strTitle = objUser.Title
strDepartment = objUser.Department
strCompany = objUser.Company
strPhone = objUser.TelephoneNumber

Set objWord = GetObject(, "Word.Application")
If objWord Is Nothing Then
Set objWord = CreateObject("Word.Application")
blnWeOpenedWord = True
End If
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection

Set objEmailOptions = objWord.EmailOptions
Set objSignatureObjects = objWord.EmailOptions.EmailSignature

Set objSignatureEntries = objSignatureObjects.EmailSignatureEntries

objSelection.TypeText strName & ", " & strTitle
objSelection.TypeParagraph
objSelection.TypeText strDepartment
objSelection.TypeParagraph
objSelection.TypeText strCompany
objSelection.TypeParagraph
objSelection.TypeText strPhone

Set objSelection = objDoc.Range()

objSignatureEntries.Add "AD Signature", objSelection
objSignatureObjects.NewMessageSignature = "AD Signature"
objSignatureObjects.ReplyMessageSignature = "AD Signature"

objDoc.Close 0
If blnWeOpenedWord Then
objWord.Quit
End If

"benb" <benb@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CA6A43E7-3483-4904-81B8-922E88C0956D@xxxxxxxxxxxxxxxx
Hi,

In this months TechNet magazine, there is a couple of pages on scripting
signatures in outlook. One of the sample scripts is a vbscript that
queries
active directory, pulls out the user info and then inserts it as a
signature.
However the article doesn't say how to set this script up in outlook.
I've
tried just adding the script to a signature, but when you insert the
signature it just displays the script as text. How do I assign the script
to
the signature so that it will work correctly?





.



Relevant Pages

  • Re: Use with Action "Send Reply" Dont Go
    ... Set Up an HTML Signature ... Go to Tools/Signatures in Entourage, ... "Auto-Reply HTML" or something similar. ... script in the Entourage Script Menu Items folder. ...
    (microsoft.public.mac.office.entourage)
  • Re: VBScript Signature in Outlook from TechNet Magazine?
    ... however in HTML it always returns a new full new paragraph. ... Sue Mosher, Outlook MVP ... "objSelection.TypeParagraph" the signature comes out with: ... The script doesn't need to be set up in Outlook. ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: VBScript Signature in Outlook from TechNet Magazine?
    ... Sue Mosher, Outlook MVP ... "objSelection.TypeParagraph" the signature comes out with: ... The script doesn't need to be set up in Outlook. ... Set objSelection = objWord.Selection ...
    (microsoft.public.office.developer.outlook.vba)
  • Re: VBScript Signature in Outlook from TechNet Magazine?
    ... I've managed to get it to pull additional info like email address, ... "objSelection.TypeParagraph" the signature comes out with: ... The script doesn't need to be set up in Outlook. ...
    (microsoft.public.office.developer.outlook.vba)
  • Outlook Script for Reply Button
    ... We have created a custom Outlook corporate signature in HTML format. ... Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item ...
    (microsoft.public.scripting.vbscript)