Re: Line Spacing

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.









.



Relevant Pages

  • Re: Line Spacing
    ... the "streetaddress" is entered in the user account as ... the TypeText method inserts carriage control characters. ... Set objSelection = objWord.Selection ... objSignatureObject.NewMessageSignature = "AD Signature" ...
    (microsoft.public.scripting.vbscript)
  • Re: Line Spacing
    ... the TypeText method inserts carriage control characters. ... Set objSelection = objWord.Selection ... objSignatureObject.NewMessageSignature = "AD Signature" ... even though the "streetaddress" is not double spaced. ...
    (microsoft.public.scripting.vbscript)
  • Re: MD5
    ... > In PHP there is MD5 function it converts strings to MD5 encription, ... MD5 is not ment as an encryption to be decrypted, but only as a signature. ... Message digest algorithms have much in common with techniques ...
    (comp.lang.php)
  • Re: Line Spacing
    ... Set objSelection = objWord.Selection ... objSignatureObject.NewMessageSignature = "AD Signature" ... even though the "streetaddress" is not double spaced. ...
    (microsoft.public.scripting.vbscript)
  • RE: Vulnerability vs. Exploit signatures and IPS??
    ... This is a bit of marketspeak, but, in general, an exploit signature would look ... at the strings in a particular exploit while vulnerability would try to match ... any pattern that would trigger the vulnerability, ... pattern "AAAAAAAAAA...AAAShEllCodeZZZZ" (256 characters) followed by the shell ...
    (Focus-IDS)