0

我是 VBS for Outlook 签名的新手。我让一切正常,但无法弄清楚最后两件。

  1. 对于objSelection.InlineShapes.AddHorizo​​ntalLineStandard,我不知道如何将其对齐到左侧。如果我不设置宽度,它会跨越整个电子邮件窗口,但我希望它的最大宽度为 300 像素。

  2. 我怎样才能让 objSelection 也有 300px 的宽度?签名上的大部分副本都很好,这只是我想限制宽度的免责声明部分。

下面是代码。任何帮助将非常感激!

    ' ########### 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()
4

1 回答 1

0

我能够格式化水平线:

With objSelection.InlineShapes.AddHorizontalLineStandard
     .Width = 200
     .HorizontalLineFormat.Alignment = 0
End With
于 2018-04-17T18:56:22.717 回答