Re: Line Spacing
- From: "Pegasus \(MVP\)" <I.can@xxxxxxxxxx>
- Date: Wed, 19 Mar 2008 21:47:32 +0100
When I ran your code then I got no blank line between
the PO Box line and the "City" line. However, I cheated:
Since I did not have an AD machine handy, I used
hard-coded strings in the string definitions up the top.
This makes me suspect that your strings aren't what you
think they are. This code might help you find the culprit:
Sub ShowString(s)
line = ""
For i = 1 To Len(s)
line = line & Mid(s,i,1) & "=" & Asc(Mid(s,i,1)) & " "
Next
WScript.echo s & ": " & line
End Sub
Now invoke ShowString for some of your strings and check
for unexpected ASCII codes below $20. It would also be
a good idea to make your Word document visible while testing
so that you can single-step through the code and watch what's
happening:
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add ()
"Michael" <support@xxxxxxxxxxxxx> wrote in message
news:e7MFXtfiIHA.5780@xxxxxxxxxxxxxxxxxxxxxxx
Those lines give me the carriage return. If I do not have them,
everything flows on one line. Also, they will put an extra blank line
when I need one.
In Active directory, the "streetaddress" is entered in the user account as
follows:
1111 Sand Ave, Suite 100
City, State Zip
When that attribute is pulled from AD, and placed in the word doc, it
appears:
1111 Sand Ave, Suite 100
City, State Zip
This "double spacing" I think is a function of Word 2007 and I would just
like to force single spacing.
Thanks Richard.
"Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx> wrote in
message news:usWR2xeiIHA.6136@xxxxxxxxxxxxxxxxxxxxxxx
What happens when you remove the lines:
objSelection.TypeText CHR(11)
Most likely, the TypeText method inserts carriage control characters. The
character Chr(11) is just the Home key, I believe.
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
"Michael" <support@xxxxxxxxxxxxx> wrote in message
news:u%23amxdeiIHA.4740@xxxxxxxxxxxxxxxxxxxxxxx
Here is my code. Please understand I have removed some distinguishing
network info, but for the most part, it is intact.
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser)
strName = objUser.FullName
strTitle = objUser.Title
strCompany = objUser.Company
strPhone = objUser.telephoneNumber
strEmail = objUser.mail
strPOBox = objUser.PostOfficeBox
strCity = objUser.l
strState = objUser.St
strZip = objUser.postalcode
strStreet = objUser.streetaddress
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
objSelection.Font.Name = "Americana BT"
objSelection.Font.Size = "11"
objSelection.Font.Color = vbBlue
objSelection.Font.Bold = True
objSelection.TypeText strName
objSelection.TypeText CHR(11)
objSelection.Font.Color = vbBlack
objSelection.Font.Bold = False
objSelection.TypeText strTitle
objSelection.TypeText CHR(11)
objSelection.Hyperlinks.Add objSelection.range, "mailto:" & strEmail, ,
, strEmail
objSelection.TypeParagraph()
objSelection.InlineShapes.AddPicture(strLogo)
objSelection.TypeText CHR(11)
objSelection.Font.Bold = True
objSelection.TypeText strCompany
objSelection.TypeText CHR(11)
objSelection.Font.Bold = False
objSelection.TypeText "PO Box" & " " & strPOBox
objSelection.TypeText CHR(11)
objSelection.TypeText strCity & ", " & strState & " " & strZip
objSelection.TypeText CHR(11)
objSelection.TypeText CHR(11)
objSelection.TypeText strStreet
objSelection.TypeText CHR(11)
objSelection.TypeText strPhone
objSelection.TypeText CHR(11)
objSelection.Font.Italic = True
objSelection.Font.Color = vbRed
objSelection.Font.Bold = True
objSelection.Font.Italic = False
objSelection.TypeText CHR(11)
objSelection.Font.Name = "Calibri"
objSelection.Font.Size = "8"
objSelection.TypeText "PERSONAL AND CONFIDENTIAL"
objSelection.Font.Color = vbBlack
objSelection.TypeText ": "
objSelection.Font.Bold = False
Set objSelection = objDoc.Range()
objSignatureEntries.Add "AD Signature", objSelection
objSignatureObject.NewMessageSignature = "AD Signature"
objSignatureObject.ReplyMessageSignature = "AD Signature"
objDoc.Saved = True
objWord.Quit
"Pegasus (MVP)" <I.can@xxxxxxxxxx> wrote in message
news:%23eDpEaeiIHA.6092@xxxxxxxxxxxxxxxxxxxxxxx
"Michael" <support@xxxxxxxxxxxxx> wrote in message
news:OtlyZJeiIHA.5152@xxxxxxxxxxxxxxxxxxxxxxx
I have a vbscript reading active directory attributes to create an
email signature. When the "streetaddress" is pulled in, it double
spaces the lines, even though the "streetaddress" is not double spaced.
Is there a code for single line spacing i can place before the street
address to force single space?
Thanks,
Michael
Let's have a look at your code.
.
- References:
- Line Spacing
- From: Michael
- Re: Line Spacing
- From: Pegasus \(MVP\)
- Re: Line Spacing
- From: Michael
- Re: Line Spacing
- From: Richard Mueller [MVP]
- Re: Line Spacing
- From: Michael
- Line Spacing
- Prev by Date: How to read text files on remote servers without mapping/unmapping drives?
- Next by Date: Re: help with cancel loops
- Previous by thread: Re: Line Spacing
- Next by thread: Re: Line Spacing
- Index(es):
Relevant Pages
|