Maintenance - We're currently working on things and you might experience some issues. Should be wrapped up soon!

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

2
vbs problem opening html file in word screwing with formatting
Post Body

I have a .vbs script that using obj.write creates an html file. Then it saves 3 versions of the file (.html, .rtf, .txt) for an outlook signature. Then it opens the html file in word and saves it as the signature. The problem is, that the file I write has proper spacing. After it opens up in word and saves it as the signature it screws with the spacing.

I am not great with vbs scripting, just enough to modify others script or kind of figure out what its doing. I tried "objSelection.ParagraphFormat.LineSpacing = 12" on the line after "Set objSelection = objDoc.Range()" but that did nothing (I even tried setting it to an absurdly large numer just to make sure).

I want to say the problem is in the last 5 lines of code where it saves the file as the signature?

Any help? Code below

'Convert the HTML Version to RTF and Plain Text:
Dim objDoc, objWord, objEmailOptions, objSignatureObject, objSignatureEntries, objSelection
Set objWord = CreateObject("Word.Application")
objWord.Visible = False
If objFSO.FileExists(strLocalSignatureFolder & "\" & strSignatureName & ".html") Then
objWord.Documents.Open strLocalSignatureFolder & "\" & strSignatureName & ".html"
Set objDoc = objWord.ActiveDocument
objDoc.SaveAs strLocalSignatureFolder & "\" & strSignatureName & ".rtf", wdFormatRTF
objDoc.SaveAs strLocalSignatureFolder & "\" & strSignatureName & ".txt", wdFormatTextLineBreaks
objDoc.SaveAs strTextSignatureFolder & "\" & strTestFileName & ".txt", wdFormatTextLineBreaks
'objDoc.SaveAs strLocalSignatureFolder & "\" & strSignatureName & ".2.html", wdFormatHTML
objDoc.Close
objWord.Quit
End If


Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(strLocalSignatureFolder & "\" & strSignatureName & ".html",,True)
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries


Set objSelection = objDoc.Range()
objSignatureEntries.Add "Full Signature", objSelection
objSignatureObject.NewMessageSignature = "Full Signature"
objDoc.Saved = True
objWord.Quit

TLDR; I need to use vbs to open a html file, that the script creates, in word and save it as the outlook signature (with correct line spacing).

Author
Account Strength
90%
Account Age
11 years
Verified Email
Yes
Verified Flair
No
Total Karma
653
Link Karma
305
Comment Karma
348
Profile updated: 9 hours ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago