Advertisement
Jungblut

Assinatura Outlook

Aug 17th, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. On Error Resume Next
  2. Set objSysInfo = CreateObject("ADSystemInfo")
  3. strUser = objSysInfo.UserName
  4. Set objUser = GetObject("LDAP://" & strUser)
  5. With objUser
  6.   strName = .GivenName
  7.   strUnderName = .SN
  8.   strTitle = .title
  9.   End With
  10.  
  11.  
  12.  
  13. Set objword = CreateObject("Word.Application")
  14. With objword
  15.  
  16.   Set objDoc = .Documents.Add()
  17.   Set objSelection = .Selection
  18.   Set objEmailOptions = .EmailOptions
  19. End With
  20.  
  21. Set objSignatureObject = objEmailOptions.EmailSignature
  22. Set objSignatureEntries = objSignatureObject.EmailSignatureEntries
  23. With objSelection
  24.  
  25.   .ParagraphFormat.Alignment = wdAlignParagraphRight
  26.   .TypeParagraph
  27.  
  28.   With .Font
  29.     .Name = "Arial"
  30.     .Size = 12
  31.     .Bold = True
  32.     .Italic = True
  33.     .Color = 100
  34.   End With
  35.     .TypeText strName & " " & strUnderName & Chr(11)
  36.     .TypeText strTitle & Chr(11)
  37.     .TypeText "TEXTO BLABLA" & Chr(11)
  38.    
  39.     .TypeText Chr(11)
  40.    objSelection.Font.Size = "12"
  41.     objSelection.Font.italic = true
  42.     objSelection.Font.Color = 100
  43.     objSelection.Font.Bold = true  
  44.     objSelection.TypeText "TEXTO BLABLABLA"
  45. End With
  46.  
  47. Set objSelection = objDoc.Range()
  48. objSignatureEntries.Add "AD Signature", objSelection
  49. objSignatureObject.NewMessageSignature = "AD Signature"
  50. objSignatureObject.ReplyMessageSignature = "AD Signature"
  51. objDoc.Saved = True
  52. objword.Quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement