vbsnoob
Goto Top

VBS bringt diverse Fehlermeldungen

Guten Tag zusammen,

ich habe einen kleinen Script programmiert, der eine einheitliche Email Signatur erstellt. Dieser Script wird per Gruppenrichtlinie beim Anmelden verteilt.

Bei einigen Usern kommt allerdings diverse Fehlermeldungen, womit ich leider garnichts anfangen kann: Hab es mal als Bild angehangen.


Hier der Quellcode von meinem Script: (Den Reply Signaturteil habe ich auskommentiert, dieser wird in einem anderen Script ausgeführt)

Danke für eure Hilfe.


' Objects  
Set objSysInfo = CreateObject("ADSystemInfo")  
Set WshShell = CreateObject("WScript.Shell")  
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)  
Set objWord = CreateObject("Word.Application")  

' Signature stuff  
strName = objUser.displayName
strDepart = objUser.Department
strDesc = objUser.Description
strStreet = objUser.StreetAddress
strLocation = objUser.l
strPostCode = objUser.PostalCode
strPhone = objUser.homePhone
strMobile = objUser.Mobile
strFax = objUser.FacsimileTelephoneNumber
strEmail = objUser.mail
strCompany = objUser.Company

aQuote = Chr(34)
aNewLine = Chr(11)

If strCompany = "Dummyhausen" then  
	strCompanyTitle = "Foobar company Dummyhausen"  
	strCompanyWeb = "http://www.specialpage.de"  
Else 
	strCompanyTitle = "BLABLA GmbH & Co. KG"  
	strCompanyWeb = "www.BLABLABLA.de"  
End If

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.Size = 10
objSelection.TypeText "Mit freundlichen Grüßen" + aNewLine  
objSelection.TypeText vbCrLf
objSelection.TypeText "i.A. "   
if (strCred) Then objSelection.TypeText strCred & strName Else objSelection.TypeText strName
objSelection.TypeText vbCrLf

objSelection.TypeText "Tel.: " & strPhone & aNewLine  
if (strFax) Then objSelection.TypeText "Fax: " & strFax & vbCrLf & vbCrLf  
if (strMobile) Then objSelection.TypeText "Mobil: " & strMobile  & aNewLine  

objDoc.Hyperlinks.Add objSelection.Range, "Mailto:" & strEmail, , , strEmail & aNewLine  
'objSelection.TypeText " && "  
objDoc.Hyperlinks.Add objSelection.Range, strCompanyWeb, , ,strCompanyWeb & aNewLine

objSelection.TypeText vbCrLf

' Bold  
objSelection.Font.Bold = True
objSelection.TypeText strCompanyTitle + aNewLine
objSelection.TypeText "Internationale Spedition" + aNewLine  
objSelection.TypeText strStreet & aNewLine
objSelection.TypeText strPostCode & " " & strLocation & aNewLine  
objSelection.Font.Bold = False
objSelection.TypeText vbCrLf

objSelection.Font.Size = 8
objSelection.TypeText "Amtsgericht asdasd / HRB 6546 BLABLA Verwaltungs-GmbH" + aNewLine  
objSelection.TypeText "Ust.-ID Nr.: asfdasf" + aNewLine  
objSelection.TypeText "Komplementärin: BLABLA Verwaltungs-GmbH" + aNewLine  
objSelection.TypeText "Geschäftsführer: Max Mustermann" + aNewLine  
objSelection.TypeText vbCrLf

objSelection.TypeText "_____________________________________________________________________________" + aNewLine  
objSelection.TypeText "HAFTUNGSHINWEIS: Wir arbeiten ausschließlich nach den Allgemeinen Deutschen Spediteurbedingungen (ADSp), neueste Fassung. Es wird darauf hingewiesen, dass nach deren Ziffer 23 die Haftung des Spediteurs bei Verlust oder Beschädigung des Gutes im Regelfall auf € 5,00 / kg Rohgewicht der Sendung beschränkt ist."  
objSelection.TypeText vbCrLf
objSelection.TypeText "VERTRAULICHKEITSHINWEIS: Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet. Jede Form der Kenntnisnahme oder Weitergabe durch Dritte ist unzulässig. Wir überwachen und untersuchen von uns versandte E-Mails auf Viren, gleichwohl können wir keine Haftung für Schäden durch von Dritter Seite angehängte Viren oder Veränderungen übernehmen."  
objSelection.TypeText vbCrLf
objSelection.TypeText "CONFIDENTIALITY NOTICE: This e-mail message (including all attachments) is for sole use of The intzended recipient(s) and may contain confidential and/or privileged information. Any Unauthorised review, use, disclosure, copying or distribution is strictly prohibeted. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. We do not accept any responsibility for damages caused anyhow by viruses transmitted via e-mail."  

objSelection.TypeText vbCrLf

Set objSelection = objDoc.Range()

' full signature  
objSignatureEntries.Add "Full Signature", objSelection  
objSignatureObject.NewMessageSignature = "Full Signature"  

objDoc.Saved = True

' reply signature  
' objSignatureEntries.Add "Reply Signature", objSelection  
' objSignatureObject.ReplyMessageSignature = "Reply Signature"  
' objDoc.Saved = True  
' EOF  
2a1ccc37f9666cef8aa5ef6476bd8f5f

996f356b8250d5983821ca36aa7ecd68

8d356ba9f3f445912a895de274832fde

Content-Key: 269436

Url: https://administrator.de/contentid/269436

Printed on: April 19, 2024 at 07:04 o'clock

Member: SlainteMhath
SlainteMhath Apr 17, 2015 updated at 08:23:10 (UTC)
Goto Top
Moin,

pack doch deinen Script bitte mal in < code > Tags - ich zähl jetzt sicher nicht 76 Zeilen mit der Hand ab .)

lg,
Slainte
Member: VBSNOOB
VBSNOOB Apr 17, 2015 at 08:21:34 (UTC)
Goto Top
habs entsprechend bearbeitet, ist nur leider um eine Zeile verrutscht, sollte aber kein Problem sein denke ich ^^