VisualBasic Outlook-Signatur Script - "Klasse unterstützt keine Automatisierung"-Fehler

Roots

Cadet 1st Year
Registriert
März 2011
Beiträge
12
Hallo

Bei mir in der Firma habe ich ein Script geschrieben, welches beim Anmelden automatisch die Signatur für den angemeldeten User erstellt. Dies funktioniert auch gut, jedoch gibt es bei manchen Usern eine Fehlermeldung, bei welcher ich nicht erahnen kann was das Problem sein könnte.

Fehlermeldung:
Skript:
\\Pfadangabe\autosignatur.vbs
Zeile: 110
Zeichen: 1
Fehler: Klasse unterstützt keine Automatisierung
Code: 800A01AE
Quelle: Laufzeitfehler in Microsoft VBScript

Interessant ist auch, dass bei den Usern, bei welchen die Fehlermeldung auftritt, die Signatur trotzdem erstellt wird.

Code:
Code:
Dim wshShell
Set wshShell = WScript.CreateObject("WScript.Shell")


Set objSysInfo = CreateObject("ADSystemInfo") 

strUser = objSysInfo.UserName
Set objUser = GetObject("LDAP://" & strUser) 
strUsername = objUser.sAMAccountName 
strName = objUser.FullName
strFirstName = objUser.FirstName
strLastName = objUser.LastName
strTitle = objUser.Title 
strDepartment = objUser.department 
strCompany = objUser.company 
strPhone = objUser.telephoneNumber 
strMobil = objUser.mobile 
strEmail = objUser.mail
strPLZ = objUser.postalcode 
strLocation = objUser.l
strStreet = objUser.streetAddress 
strFAX = objUser.facsimileTelephoneNumber 
strDepartment = objUser.department 
strDesc = objUser.description 
strWeb = objuser.wWWHomePage 




If IsArray(objUser.MemberOf) Then
strGroup = LCase(Join(objUser.MemberOf))
Else
strGroup = lcase(objUser.MemberOf) 
End If
 

Set objWord = CreateObject("Word.Application") 
Set objDoc = objWord.Documents.Add() 
Set objSelection = objWord.Selection 
Set objEmailOptions = objWord.EmailOptions 
Set objSignatureObject = objEmailOptions.EmailSignature 
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries 

objSelection.Font.Name = "Arial" 
ObjSelection.Font.Bold = False
objSelection.Font.Size = "10"
objSelection.Font.Color = RGB(99,102,106)


objselection.typetext "Freundliche Grüsse"
objSelection.Typetext(chr(11))
objSelection.Typetext(chr(11))

objSelection.Font.Name = "Arial" 
ObjSelection.Font.Bold = True
objSelection.Font.Size = "10"
objSelection.Font.Color = RGB(99,102,106)


objselection.typetext strFirstName & " " & StrLastName
objSelection.Typetext(chr(11))
objSelection.Font.Name = "Arial" 
ObjSelection.Font.Bold = False  
objSelection.Font.Size = "10"

If strTitle = "" then
  objSelection.Font.Size = "4"
Else 
  objSelection.TypeText strTitle
  objSelection.Font.Size = "4"
  objSelection.Typetext(chr(11))
End If

objSelection.Font.Size = "10"

If strDepartment = "" then

Else 
  objSelection.TypeText strDepartment
  objSelection.Typetext(chr(11))
End If

objSelection.Font.Size = "4"
objSelection.Typetext(chr(11))
Set shp = objSelection.InlineShapes.AddPicture("\\pfad\logo.png")
objSelection.Typetext(chr(11))
objSelection.Font.Size = "10"
objSelection.Typetext "––––––––––––––––––––––––––––––––––––––"
objSelection.Typetext(chr(11))
objSelection.Font.Color = RGB(00,151,169)
objSelection.Typetext strCompany
objSelection.Typetext(chr(11))
objSelection.Font.Color = RGB(99,102,106)
objSelection.Typetext strStreet & " • " &  StrPLZ & " " & strLocation
objSelection.Typetext(chr(11))
objSelection.Typetext strPhone
objSelection.Typetext(chr(11))
objSelection.Font.Name = "Arial"
Set objLink = ObjSelection.Hyperlinks.Add (objSelection.range, strWeb,,,strWeb)
objLink.Range.Font.Color = RGB(99,102,106) 
objLink.Range.Font.Name = "Arial"
objLink.Range.Font.Size = "10" 
objLink.Range.Font.Underline = False
objSelection.Typetext(chr(11))



Set objSelection = objDoc.Range() 
objSignatureEntries.Add "Default" , objSelection 
objSignatureObject.NewMessageSignature = "Default" 
objSignatureObject.ReplyMessageSignature = "Default"  
objDoc.Saved = True 
objWord.Quit

Vielen Dank schon mal für euer Bemühen!;)
 
Hallo,

in der letzten Zeit gab es öfters Office-Updates, nach denen solche "Automatisierungen" wegen Sicherheitslücken ungültig gemacht wurden. Ich bin mir nicht sicher, ob es dein Problem lösen wird, aber mir hilft es bei ähnlichen Geschichten.
Immer wenn diese Meldungen nach einem Office-Update auftritt führe ich auf dem betroffenen Rechner in cmd den Befehl "regsvr32 C:\WINDOWS\system32\MSCOMCTL.OCX" aus.
Ich hoffe, dass es auch dir helfen wird.
 

Ähnliche Themen

Zurück
Oben