Check alle échte Black Friday-deals Ook zo moe van nepaanbiedingen? Wij laten alleen échte deals zien
Toon posts:

VBS en resetten van font

Pagina: 1
Acties:

Verwijderd

Topicstarter
Ik ben bezig met het opzetten van een script* om centraal voor alle medewerkers een Outlook handtekening aan te maken. Ik heb de code helemaal onderaan staan.
Dit werkt zonder problemen, behalve dat 1 detail ons toch erg stoort:

Omdat we een aantal delen zoals de naam in een afwijkende kleur willen hebben doen we op een gegeven moment een objSelection.Font.Color = RGB(15,36,62) waarbij de RGB waarde natuurlijk afhankelijk is van de gewenste kleur.
Die font color blijft echter voor de volgende regels behouden en de enige manier om de font color weer te veranderen is met een nieuwe font color, bijvoorbeeld naar de kleur zwart.

Als je een nieuwe e-mail verstuurd is de tekst in de e-mail standaard/automatisch zwart en mag/moet de handtekening dus ook zwart zijn voor de gewone stukken tekst. Dit is akkoord dus
Echter als je een e-mail beantwoord of doorstuurt dan is de tekst automatisch een blauwe kleur. Als de handtekening dan zwart is dan lijkt dat vreemd...

Maak je handmatig een handtekening aan in Outlook met de tekstkleur op automatisch dan is de tekst bij een nieuwe e-mail zwart, en bij het beantwoorden van een e-mail dezelfde lichtblauw.

Dat willen we ook bij de automatisch aangemaakt handtekening, dat bij de standaard tekst is de font color weer op "automatisch" staat nadat we een afwijkende kleur hebben gebruikt, maar ik kan niet vinden hoe.
Ik heb al geprobeerd: objSelection.Font.Color = 0, NULL, '' (geeft foutmelding), Auto, Automatic, xlAutomatic, reset
(op dit moment staat in onderstaande script het gedeelte welke ik automatisch wil hebben met font.color= 0 aangeduid)

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
On Error Resume Next

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

strName = objUser.FullName
strTitle = objUser.Description
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

'friendly closing message
objSelection.TypeText "Met vriendelijke groeten,"
objSelection.TypeText(Chr(11))
objSelection.TypeText(Chr(11))

'Name of Staff
objSelection.Font.Name = "Calibri"
objSelection.Font.Bold = True
objSelection.Font.Size = "12"
objSelection.Font.Color = RGB(115,155,63)
objSelection.TypeText strName
objSelection.TypeText(Chr(11))

'Role of Staff
objSelection.Font.Name = "Calibri"
objSelection.Font.Bold = False
objSelection.Font.Size = "11"
objSelection.Font.Color = 0
objSelection.TypeText strTitle
objSelection.TypeText(Chr(11))


'Company Logo (stored in network share accessed by everyone)
objSelection.InlineShapes.AddPicture("\\server\sysvol\handtekeningen\plaatje.jpg")
objSelection.TypeParagraph()

'Company Contact details
objSelection.Font.Color = 0
objSelection.TypeText "adres"
objSelection.Font.Color = RGB(115,155,63)
objSelection.TypeText " | "
objSelection.Font.Color = 0
objSelection.TypeText "postcode"
objSelection.Font.Color = RGB(115,155,63)
objSelection.TypeText " | "
objSelection.Font.Color = 0
objSelection.TypeText "plaats"
objSelection.TypeText(Chr(11))

objSelection.Font.Color = 0
objSelection.TypeText "Tel: 0123 456789"
objSelection.Font.Color = RGB(115,155,63)
objSelection.TypeText " | "
objSelection.Font.Color = reset
objSelection.TypeText "Fax: 0123 456789"
objSelection.TypeText(Chr(11))


'EmailAddress of Staff and website
objSelection.Font.Color = 0
objSelection.Hyperlinks.Add objselection.range, "mailto:" & strEmail,,,strEmail
objSelection.Font.Color = RGB(115,155,63)
objSelection.TypeText " | "
'objSelection.Font.Color = 0
objLink = objSelection.Hyperlinks.Add(objSelection.Range,"http://www.bedrijfnaam.nl/”",,"Website bedrijfnaam","www.bedrijfnaam.nl")
objSelection.TypeParagraph()
objSelection.TypeParagraph()



'environment message
objSelection.Font.Name = "Webdings"
objSelection.Font.Size = "14"
objSelection.Font.Color = RGB(115,155,63)
objSelection.TypeText "P "
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 "Standard Signature", objSelection
objSignatureObject.NewMessageSignature = "Standard Signature"
objSignatureObject.ReplyMessageSignature = "Standard Signature"

objDoc.Saved = True
objWord.Quit

* script is grotendeels afkosmtig van grotendeels afkomstig van http://technobuff.wordpre...ive-directory-information

Verwijderd

Topicstarter
kick
niemand die weet hoe je de font color weer verwijderd?

  • Woy
  • Registratie: April 2000
  • Niet online

Woy

Moderator Devschuur®
Verwijderd schreef op maandag 02 december 2013 @ 10:57:
kick
niemand die weet hoe je de font color weer verwijderd?
Ik heb totaal geen ervaring met outlook, maar is het niet gewoon een kwestie van aan het begin ( Voordat je zelf wat wijzigt ) de font-kleur opvragen, en die aan het eind weer terug zetten?

“Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.”


  • _js_
  • Registratie: Oktober 2002
  • Laatst online: 25-10 14:28
Misschien werkt door niet de kleur te veranderen vanaf waar de cursor staat, maar een selectie te maken en alleen van het geselecteerde de kleur aan te passen.

  • Merethil
  • Registratie: December 2008
  • Laatst online: 08:50
Om heel eerlijk te zijn lijkt me Woy's aanpassing een hoop minder werk dan die van jou, _js_.
Je kan de kleur gewoon opslaan in een variabele waarna je hem reset als dat nodig is, toch? Lijkt mij de meest gangbare solutie.