如何在VBSSCRIPT上垂直对齐图像

时间:2016-05-12 10:21:37

标签: vbscript word-vba

感谢网站,感谢您花时间阅读本文。

我创建了一个基于VBS脚本的签名,我在网上为众多网站提取并获得了几乎我想要的签名,只是在我停止搞乱之前再做了一些调整。我似乎无法使垂直对齐工作。你能帮帮我吗。

下面是代码,图中显示了我需要的图片。

  1. 我需要将右侧图像移动到底部对齐位置
  2. 我需要移除蓝色条和上面的桌子之间的空间。
  3. 赞助帮助,我不是一个程序员,只是尽力在outlook中自动签名。

     On Error Resume Next
    'Option Explicit
    
    Dim objSysInfo,strUser,objUser,strName,strMail,strWebAddr,strCompany,strDepartment,strStreetAddr,strHomePhone,strIpPhone,strMobile
    Dim objWord,objDoc,objSelection,objEmailOptions,objSignatureObject,objSignatureEntries,objLink,strlogoATL,strlogoMA,strlogoBAR
    Dim objRange,objTable
    
    Set objSysInfo = CreateObject("ADSystemInfo")
    strUser = objSysInfo.UserName
    Set objUser = GetObject("LDAP://" & strUser)
    
    strName = objUser.FirstName &" "& objUser.LastName
    strMail = objuser.mail
    strWebAddr = objuser.wWWHomePage
    strCompany = objuser.Company
    strDepartment = objUser.Department
    strStreetAddr = objuser.streetaddress
    strHomePhone =  objuser.HomePhone
    strIpPhone = objuser.ipPhone
    strMobile = objuser.Mobile
    
    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 of Staff
    objSelection.Font.Name = "Verdana"
    objSelection.Font.Size = "10"
    objSelection.Font.Color = RGB(91,91,91)
    objSelection.TypeText strName
    objSelection.TypeText(Chr(11))
    
    objSelection.TypeParagraph()
    
    'Mail
    objSelection.Font.Name = "Verdana"
    objSelection.Font.Size = "8"
    objSelection.Font.Color = RGB(91,91,91)
    Set objLink = objSelection.Hyperlinks.Add(objSelection.Range, "mailto: " & strMail, , , strMail) 
    objSelection.TypeText(Chr(11))
    
    'Tel
    objSelection.Font.Name = "Verdana"
    objSelection.Font.Size = "8"
    objSelection.Font.Color = RGB(91,91,91)
    objSelection.TypeText "Ext : "& strIpPhone & "   " & " "& chr(124) & "   Telem" & Chr(243) & "vel : " & strMobile
    objSelection.TypeText(Chr(11))
    
    objSelection.TypeParagraph()
    
    
    'Department
    objSelection.Font.Name = "Verdana"
    objSelection.Font.Size = "8"
    objSelection.Font.Color = RGB(0,153,181)
    objSelection.TypeText strDepartment
    objSelection.TypeText(Chr(11))
    
    'Address
    objSelection.Font.Name = "Verdana"
    objSelection.Font.Size = "8"
    objSelection.Font.Color = RGB(0,153,181)
    objSelection.TypeText strStreetAddr
    objSelection.TypeText(Chr(11))
    
    objSelection.TypeParagraph()
    
    'Company Contact details
    objSelection.Font.Name = "Verdana"
    objSelection.Font.Color = RGB(0,153,181)
    objSelection.TypeText "Tel : "& strHomePhone & "    " & chr(124) & "   "
    
    'Web
    objSelection.Font.Name = "Verdana"
    objSelection.Font.Color = RGB(0,153,181)
    set objLink = objSelection.Hyperlinks.Add(objSelection.Range,strWebAddr)
    
    
    strlogoATL="c:\Utils\Assinatura\ins_atl.jpg"
    strlogoMA="c:\Utils\Assinatura\ins_ma.jpg"
    strlogoBAR="c:\Utils\Assinatura\ins_bar.jpg"
    
    Set objRange = objSelection.Range
    objDoc.Tables.Add objRange, 1, 2
    Set objTable = objDoc.Tables(1)
    objTable.leftpadding = 0
    objTable.rightpadding = 0
    
    objTable.Columns(1).Width = objWord.CentimetersToPoints(12.00)
    objTable.Cell(1, 1).Range.InlineShapes.AddPicture(strlogoATL)
    
    objTable.Columns(2).Width = objWord.CentimetersToPoints(12.00)
    objTable.Cell(1, 2).Range.ParagraphFormat.Alignment = 2
    objTable.Cell(1, 2).Range.VerticalAlignment = wdAlignVerticalCenter
    objTable.Cell(1, 2).Range.InlineShapes.AddPicture(strlogoMA)
    
    objSelection.EndKey 6
    objSelection.TypeParagraph()
    
    Set objRange = objSelection.Range
    objDoc.Tables.Add objRange, 1, 1
    Set objTable = objDoc.Tables(2)
    objTable.leftpadding = 0
    objTable.rightpadding = 0
    
    objTable.Columns(1).Width = objWord.CentimetersToPoints(24.00)
    objTable.Cell(1, 1).Range.InlineShapes.AddPicture(strlogoBAR)
    
    objSelection.EndKey 6
    
    objSelection.TypeParagraph()
    
    Set objSelection = objDoc.Range()
    
    objSignatureEntries.Add "ATLANTICO", objSelection
    objSignatureObject.NewMessageSignature = "ATLANTICO"
    objSignatureObject.ReplyMessageSignature = "ATLANTICO"
    objDoc.Saved = True
    objWord.Quit
    
    wscript.echo "Uma nova assinatura foi aplicada ao seu Outlook!"
    

    下面显示的问题图片

    enter image description here

0 个答案:

没有答案