VBS - toevoegen signature aan outlook probleem

Status
Niet open voor verdere reacties.

BartP

Gebruiker
Lid geworden
10 jan 2008
Berichten
37
goedenmiddag,

Ik ben al een hele tijd aan het *****n, maar ik krijg het niet voor elkaar om een bestaande handtekening "mail signature.html" toe te voegen aan outlook. als hij de file moet openen krijg ik de volgende melding **file is not found**, alleen het bestand staat daar wel.
Weet iemand waar dit aan ligt.

Hieronder de Code

Code:
' Execute.vbs
' VBScript to copy certain files to a specified path
' Author BartP
' Version 1.0 - August 2009
' ---------------------------------------------------------' 


'Declaring variables
Dim objFSO, oIE, oIEDoc, objSourceFolder, objDestinationFolder, objWord, objDoc, objSelection, objEmailOptions, objSignatureObject, objSignatureEntries

'Set values'
objSourceFolder = "mail signature_files"
objDestinationFolder = "U:\Application Data\Microsoft\Signatures\mail signature_files"

'Setting objects
Set objFSO = CreateObject("Scripting.FileSystemObject")
set objWshell = Wscript.CreateObject("Wscript.Shell")
Set oIE = Wscript.CreateObject("InternetExplorer.Application")

Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open("mail signature.html")
Set objSelection = objWord.Selection
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObjects = objWord.EmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObjects.EmailSignatureEntries
Set objSelection = objDoc.Range()


'Initialize the "Please Wait" window
oIE.Navigate "about:blank"
do while oIE.busy : wscript.sleep 10 : loop
Set oIEDoc = oIE.Document

'Get rid of the toolbars because it`s a IE window
oIE.AddressBar = False
oIE.StatusBar = False
oIE.ToolBar = False
oIE.Document.Body.Scroll = "no"
oIE.document.title = "... - Kopieren van bestanden"
oIE.height=150
oIE.width=400
oIE.Resizable = False
oIE.Visible = True

'this message will be displayed inside the window
sMsg= "<center>Bestanden worden gekopieerd.<br>Even geduld a.u.b. ...</center>"
oIEDoc.Body.Innerhtml= sMsg

'check if destinationfolder exists
If objFSO.FolderExists("U:\Application Data\Microsoft\Signatures") <> True Then	
	objFSO.CreateFolder("U:\Application Data\Microsoft\Signatures")
	MsgBox "De directory *Signatures* is aangemaakt",1,"Directory"
	Else If objFSO.FolderExists("U:\Application DATA\Microsoft\Signatures\mail signature_files") <> True Then
		objFSO.CreateFolder("U:\Application Data\Microsoft\Signatures\mail signature_files")
	End If
End If

ObjFSO.CopyFolder (objSourceFolder), (objDestinationFolder), True



'Adding and setting the new signature'
objSignatureEntries.Add "mySignature", objDoc
objSignatureObject.NewMessageSignature = "mySignature" 
objSignatureObject.ReplyMessageSignature = "mySignature"


'this will close the "Even geduld a.u.b." window
Set oIEDoc = Nothing
oIE.Quit
Set oIE = Nothing

Set objFSO = Nothing
Set objWshell = Nothing
Set WshShell = Nothing

'Close object word'
objWord.Quit 

'this will display a MsgBox after the "Even geduld a.u.b." window closes, letting the user know that process is complete
MsgBox "Kopieren en instellen voltooid", 64 + 262144, "Kopieren voltooid"
 
Laatst bewerkt door een moderator:
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan