none
Outlook signature problems / VB(A) RRS feed

  • Question

  • We are using a vbscript to assign a Outlook 2010 signature to the users that are logging in the network.

    A few things are a problem. First the logo is different when we open it in a editor it looks sharp etc. In Outlook it looks less sharp and smaller or larger. I have read that this is because Outlook is making a 96 dpi image of it. So i saved the jpg as a 96 dpi image but then it becomes 500 kb so thats to large.

    The second problem i have is the color of the text in the script. Whatever i use for color the color is not much changing in Outlook. It looks much lighter then the color code says. Below is a part of the script. Is there something not right?

    For example i have made the color www.company.com magenta but it stays the same in Outlook after restarting the system twice. It is also not underlined anymore so it is not a link. Something in the code must be wrong....

    Between the lines the fonts are made arial 10 pt and a kind of darkgrey, but in Outlook it isgrey, also when you print it..

    Outlook seems to do things on his own or is ignoring the script RGB CODE in this case? For example when i make the RGB (255,0,0) the tekst should be red but it stays the same...

    Set objSysInfo = CreateObject("ADSystemInfo")

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

    strVoornaam = objUser.FirstName
    strAchternaam = objUser.LastName
    strTitle = objUser.Title
    strDepartment = objUser.Department
    strCompany = objUser.Company
    strPhone = objUser.telephoneNumber
    strFax = objUser.FacsimileTelephoneNumber
    strMobile = objUser.Mobile
    strLand = objUser.st
    strGroet = objUser.StreetAddress
    strDescription = objUser.Description
    strOffice = objUser.PhysicalDeliveryOfficeName
    strMail = objUser.Mail
    strWeb = objUser.wWWHomePage
    strPObox = objUser.postOfficeBox
    strCity = objUser.l
    strZip = objUser.postalcode
    strHome = objUser.HomePhone
    strIP = objUser.ipPhone
    strNotes = objUser.info


    Set objWord = CreateObject("Word.Application")
    objWord.Visible = False
    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

    objSelection.Font.Name = "Arial"
    objSelection.Font.Size = "10"
    objSelection.Font.Color = RGB(47,79,79)
    objSelection.Font.Bold = True
    objSelection.TypeText " with kind regards," & Chr(11)
    'If strGroet = not "" then objSelection.TypeText strGroet
    'objSelection.TypeText ","
    ObjSelection.TypeText Chr(11)
    objSelection.TypeText strForname & " "
    objselection.TypeText strBack & Chr(11)
    objSelection.TypeText strTitle & " "
    objSelection.TypeText strNotes & Chr(11)
    'objSelection.TypeText Chr(11)

    'ObjSelection.TypeText Chr(11)
    Set objShape = objSelection.InlineShapes.AddPicture("\\path\logo.jpg") & Chr(11)
    ObjSelection.TypeText Chr(11)

    objSelection.TypeText "Internet: "

    objSelection.Font.Name = "Arial"
    objSelection.Font.Size = "10"
    objSelection.Font.Color = RGB(255,0,255)
    objSelection.Font.Italic = False
    objSelection.Font.Bold = False
    If strWeb = "" Then
    objSelection.TypeText "http://www.company.com" & Chr(11)
    'objSelection.TypeText Chr(11)
    else objSelection.TypeText strWeb & Chr(11)
    End If

    objSelection.Font.Name = "Arial"
    objSelection.Font.Size = "9"
    objSelection.Font.Color = RGB(47,79,79)
    objSelection.Font.Italic = False
    objSelection.Font.Bold = True



    freddie

    Monday, September 29, 2014 10:02 AM

All replies

  • Hello Freddie,

    What code do you use for setting up the signature in Outlook?

    I see the code for Word only. Does it work properly in Word?
    Monday, September 29, 2014 10:07 AM
  • Hello Freddie,

    What code do you use for setting up the signature in Outlook?

    I see the code for Word only. Does it work properly in Word?

    Appologies for reacting so late. Above is the code without the last part that is:

    Set objSelection = objDoc.Range()
    objSignatureEntries.Add "company AD", objSelection
    objSignatureObject.NewMessageSignature = "company AD"
    objSignatureObject.ReplyMessageSignature = "company AD"

    objDoc.Saved = True
    objWord.Quit

    How can i see that it is properly working in Word? When the user logs in on his computer for several seconds an Outlook icon appears in the right corner which is the signature for Outlook because it takes a few seconds to process the script.


    freddie

    Wednesday, October 8, 2014 10:17 AM
  • Hello Freddie,

    Why do you need to use the Word object model for creating a signature?

    Did you try to use the Outlook object model instead?

    Wednesday, October 8, 2014 11:49 AM
  • Hello Freddie,

    Why do you need to use the Word object model for creating a signature?

    Did you try to use the Outlook object model instead?

    Ok..i must say that the script was not made by me, someone else made it. Now we have a new logo and i must edit the script.

    Problem we have also with a lot of users that the new logo isn't working. Outlook keeps the logo that it was before. While other users do get the new logo. When i put the new logo locally in the .htm file for signature Outlook displays the right logo but when the script runs a new .htm file is placed the wrong logo is int he .htm page very strange....

    I do not know how to use the Outlook Object model, maybe you can help me out?


    freddie

    Wednesday, October 8, 2014 2:30 PM
  • Hi Freddie,

    The Outlook for developers hub in MSDN provides all the required information.

    Wednesday, October 8, 2014 3:22 PM
  • Hi Freddie,

    The Outlook for developers hub in MSDN provides all the required information.

    Thanks.

    But to find out how that works i need a complete course i am afraid. The code is there but it is based on Word i understand from you. Must the code completely rewritten or is it simple to edit the code so that the Outlook Model is uses. You know i am not a developer...


    freddie

    Thursday, October 9, 2014 6:08 AM
  • Hello Freddie,

    The current forum is for developers.

    The Word and Outlook object model are entirely different. You may find the following links helpful:

    How to add default signature in Outlook

    Set Default Signature outlook

    Thursday, October 9, 2014 10:05 AM
  • Hello Freddie,

    The current forum is for developers.

    The Word and Outlook object model are entirely different. You may find the following links helpful:

    How to add default signature in Outlook

    Set Default Signature outlook

    Ok. But that this is a developers forum is the reason why i am asking it here. We have a script running that sets the signature in Outlook. This worked for quite a while but now we have to  insert a new logo and all kind of things rise.  Besides from rewriting the script you could help me to look at the script where the logo is inserted and maybe you see that the manner the logo is inserted or some script language that is not correct?

    What for example in above script is putting the htm rtf and txt files in the signature folder and also puts a new logo in the HTM file, because this is the reason that the logo is not replaced on my pc at least.

    Thanks.


    freddie

    Friday, October 10, 2014 6:46 AM
  • Freddie,

    Your code is not related to the Outlook object model. I'd suggest asking Word object model specific questions on the Word for Developers forum instead.

    Also I have notices the following line of code:

    > Set objShape = objSelection.InlineShapes.AddPicture("\\path\logo.jpg") & Chr(11)

    Did you specify the relative path? Did you try to specify the absolute path instead? Does it help?

    Friday, October 10, 2014 8:31 AM
  • I use \\sharename\logo.jpg..


    freddie

    Friday, October 10, 2014 11:44 AM
  • Is the image shown in the signature?

    If not, did you try to specify the absolute path instead? Does it help?

    Friday, October 10, 2014 12:27 PM
  • Is the image shown in the signature?

    If not, did you try to specify the absolute path instead? Does it help?

    The image is shown in the signature but is now a bad quality with some users but by some users it is good.

    I have changed the code to the absolute path: \\server\d$\folderwhereimageis\image.jpg

    Unfortunually this has no effect.


    freddie

    Monday, October 27, 2014 3:00 PM