VB Script for Email Signature Resolution adjustment

Answered VB Script for Email Signature Resolution adjustment

  • Thursday, February 14, 2013 2:52 PM
     
     

    Hi Scripting Guy,

    I have a VB script that I rolled out on the domain through GPO. On outlook 2003 it looks perfect but when I send a mail and it is opened by outlook 2007 and above the icons are in a different place and the ones rolled out on outlook 2010 looks slightly different.

    I believe that this is maybe a resolution that doesn't adjust to the other user's resolution.... This is my script and I don't know if there is a command that specify for everything to fit to that resolution. Even if you zoom in and out it messes up the small icons a bit.
    Here is my script:

    On Error Resume Next

    Set objSysInfo = CreateObject("ADSystemInfo")
    strUser = objSysInfo.UserName
    Set objUser = GetObject("LDAP://" & strUser)

    strName = objUser.FullName
    strCompany = objUser.Company
    strTitle = objUser.Title
    'strDepartment = objUser.Department
    strPhone = objUser.telephoneNumber
    strFax = objUser.faxnumber
    strMobile = objUser.mobile
    strEmail = objUser.emailaddress

    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 = "Calibri"
    objSelection.Font.Bold = True
    objSelection.Font.Size = "11"
    objSelection.Font.Color = RGB(0,0,0)
    objSelection.TypeText strName
    objSelection.TypeText(Chr(11))


    'Role of Staff
    objSelection.Font.Name = "Calibri"
    objSelection.Font.Bold = True
    objSelection.Font.Size = "11"
    objSelection.Font.Color = RGB(173,152,65)
    objSelection.TypeText strTitle
    objSelection.TypeText(Chr(11))
    objSelection.TypeText(Chr(11))

    objSelection.Font.Name = "Calibri"
    objSelection.Font.Bold = True
    objSelection.Font.Size = "11"
    objSelection.Font.Color = RGB(0,0,0)

    objSelection.TypeText "Some information"
    objSelection.TypeText(Chr(11))

    objSelection.Font.Name = "Calibri"
    objSelection.Font.Bold = False
    objSelection.Font.Size = "11"
    objSelection.Font.Color = RGB(0,0,0)

    objSelection.TypeText "More information re my company"   
    objSelection.TypeText(Chr(11))

    objSelection.Font.Name = "Calibri"
    objSelection.Font.Bold = False
    objSelection.Font.Size = "11"
    objSelection.Font.Color = RGB(0,0,0)

    objSelection.TypeText "Tel: " & strPhone & " | " & "Fax: " & strFax & " | " & "Cell: " & strMobile
    objSelection.TypeText(Chr(11))

    objLink = objSelection.Hyperlinks.Add(objSelection.Range,"website link",,, "name of link","_Blank")
    objSelection.TypeText "                                                                                          "
    objSelection.InlineShapes.AddPicture("\\server\NETLOGON\signatures\Facebook.gif")
    With (objDoc)
    objDoc.Hyperlinks.Add objDoc.InlineShapes.Item(1), "https://www.facebook.com"
    End With
    objSelection.TypeText " "
    objSelection.InlineShapes.AddPicture("\\server\NETLOGON\signatures\Twitter.gif")
    With (objDoc)
    objDoc.Hyperlinks.Add objDoc.InlineShapes.Item(2), "https://www.twitter.com"
    End With
    objSelection.TypeText " "
    objSelection.InlineShapes.AddPicture("\\server\NETLOGON\signatures\Tripadvisor.gif")
    With (objDoc)
    objDoc.Hyperlinks.Add objDoc.InlineShapes.Item(3), "www.tripadvisor.com"
    End With
    objSelection.TypeText(Chr(11))

    'Company Logo (stored in network share accessed by everyone)
    objSelection.InlineShapes.AddPicture("\\server\NETLOGON\signatures\My main signature banner.gif")
    With (objDoc)
    objDoc.Hyperlinks.Add objDoc.InlineShapes.Item(4), "link if you click on the banner"
    End With
    objSelection.TypeText(Chr(11))
    'objSelection.TypeParagraph()

    'objSelection.TypeText "                                                                     "
    objSelection.Hyperlinks.Add objSelection.Range, "1",,, "Home","_Blank"
    objSelection.TypeText " | "
    objSelection.Hyperlinks.Add objSelection.Range, "2",,, "2","_Blank"
    objSelection.TypeText " | "
    objSelection.Hyperlinks.Add objSelection.Range, "3",,, "3","_Blank"
    objSelection.TypeText " | "
    objSelection.Hyperlinks.Add objSelection.Range, "5",,, "4","_Blank"
    objSelection.TypeText " | "
    objSelection.Hyperlinks.Add objSelection.Range, "5",,, "5","_Blank"
    objSelection.TypeText " | "
    objSelection.Hyperlinks.Add objSelection.Range, "6",,, "6","_Blank"
    objSelection.TypeText "  "
    objSelection.TypeText(Chr(11))

    'environment message or something
    'objSelection.Font.Name = "Webdings"
    'objSelection.Font.Size = "8"
    'objSelection.Font.Color = RGB(115,155,63)
    'objSelection.TypeText ""
    'objSelection.Font.Name = "Calibri"
    'objSelection.Font.Size = "9"
    'objSelection.TypeText "Please consider the environment before printing this e-mail."


    Set objSelection = objDoc.Range()
    objSignatureEntries.Add "AHS", objSelection
    objSignatureObject.NewMessageSignature = "sig_name"
    objSignatureObject.ReplyMessageSignature = "sig_name"
    objSignatureObject.ForwardMessageSignature = "sig_name"


    objDoc.Saved = True
    objWord.Quit

    Thank you in advance!

    Regards Jay

All Replies