0

I'm new to VBS for Outlook signatures. I got everything working but can't figure out the last 2 pieces.

  1. For the objSelection.InlineShapes.AddHorizontalLineStandard, I don't know how to align it to the left. If I don't put the width, it spans the whole email window but I want it to be max width at 300px.

  2. How can I get the objSelection to also have a width of 300px? Most of the copy on the signature is fine, it's just the disclaimer part that I would like to keep the width restricted.

Below is the code. Any help would be much appreciated!

    ' ########### Sets up word template

    Set objWord = CreateObject("Word.Application")
    Set objDoc = objWord.Documents.Add()
    Set objSelection = objWord.Selection
    objSelection.Style = "No Spacing"
    Set objEmailOptions = objWord.EmailOptions
    Set objSignatureObject = objEmailOptions.EmailSignature
    Set objSignatureEntries = objSignatureObject.EmailSignatureEntries



    ' ########### Name, title, company

    objSelection.InlineShapes.AddHorizontalLineStandard.Width = 300
    objSelection.Font.Name = "Calibri"
    objSelection.Font.Size = 11
    objselection.Font.Bold = true
    objSelection.Font.Color = RGB (000,000,000)

    objSelection.TypeText strGiven & " " & strSurname
    objselection.TypeText Chr(11)

    objSelection.TypeText strTitle
    objselection.TypeText Chr(11)

    objselection.TypeText "Xtreme Manufacturing" & chr(153)
    objSelection.InlineShapes.AddHorizontalLineStandard.Width = 300
    objselection.TypeText Chr(11)



    ' ############ Logo

    Set objLink = objSelection.Hyperlinks.Add(objSelection.InlineShapes.AddPicture("https://www.xmfg.com/wp-content/themes/xmfg_s/images/email-sig/xmfg.gif"), "http://www.xmfg.com",,,"")
    objselection.TypeText Chr(11)
    objSelection.TypeParagraph()



    ' ############ Address

    objSelection.Font.Name = "Calibri"
    objSelection.Font.Size = 10
    objselection.Font.Bold = false
    objSelection.Font.Color = RGB (000,000,000)

    If (objUser.postofficebox = "") Then

    objSelection.TypeText strAddress1
    objselection.TypeText Chr(11)

    objSelection.TypeText strAddress2 & ", " & strAddress3 & " " & strPostCode
    objselection.TypeText Chr(11)
    objSelection.TypeParagraph()

    Else

    objSelection.TypeText strAddress1
    objselection.TypeText Chr(11)

    objSelection.TypeText strAddress1Ext
    objselection.TypeText Chr(11)

    objSelection.TypeText strAddress2 & ", " & strAddress3 & " " & strPostCode
    objselection.TypeText Chr(11)
    objSelection.TypeParagraph()

    End If


    ' ########### Phone, mobile, fax

    Set objRange = objSelection.Range
    objDoc.Tables.Add objRange, 3,2
    Set objTable = objDoc.Tables(1)

    objTable.AutoFitBehavior(1)
    objTable.leftpadding = 0.4
    objTable.rightpadding = 0

    objTable.Cell(1, 1).Range.Text = "T"
    objTable.Cell(1, 2).Range.Text = ": +1 " & strPhone & " " & "ext " & strExt

    objTable.Cell(2, 1).Range.Text = "M"
    objTable.Cell(2, 2).Range.Text = ": +1 " & strMobile

    objTable.Cell(3, 1).Range.Text = "F"
    objTable.Cell(3, 2).Range.Text = ": +1 " & strFax

    objSelection.EndKey 6



    ' ########### Website

    Const wdParagraph = 3
    Const wdExtend = 1
    Const wdCollapseEnd = 0

    Set objLink = objSelection.Hyperlinks.Add(objSelection.Range,    "http://www.xmfg.com", , , "www.xmfg.com")
    objLink.Range.Font.Size = 10
    objLink.Range.Font.Bold = true
    objSelection.Font.Name = "Calibri"
    objselection.TypeText Chr(11)
    objSelection.TypeParagraph()

    objSelection.StartOf wdParagraph, wdExtend
    objSelection.Font.Color = RGB(000,000,000)
    objSelection.Collapse wdCollapseEnd



    ' ########### Disclaimer

    objSelection.Font.Name = "Calibri"
    objSelection.Font.Size = 8
    objselection.Font.Bold = false
    objSelection.Font.Color = RGB (000,000,000)
    objSelection.Textwidth = 3

    objSelection.TypeText "The email and attachments hereto are strictly confidential and intended solely for the addressee. If you are not the intended addressee, please notify the sender by return and delete the message. You must not disclose, forward or copy this email or attachments to any third party without prior consent of the sender."
    objselection.TypeText Chr(11)
    objSelection.TypeParagraph()

    objSelection.TypeText "The Xtreme Manufacturing name and logos, and all related product and service names, design marks and slogans are the trademarks of Xtreme Manufacturing. All rights are expressly reserved herein. Any reproduction, copies, or exploitation in any manner and for any purpose without the express written consent of Xtreme Manufacturing is strictly prohibited. "
    objselection.TypeText Chr(11)
    objSelection.TypeParagraph()
0

1 Answer 1

0

I was able to get the horizontal line formatted:

With objSelection.InlineShapes.AddHorizontalLineStandard
     .Width = 200
     .HorizontalLineFormat.Alignment = 0
End With

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.