Skip navigation

Add a Signature to an Email Message - VBScript

'********************************************* 'VBScript to add a signature to a mail message '********************************************* 'Retrieve the Documents folder from the Registry Set objWord = Item.Application.CreateObject("Word.Application") strDocsDir = objWord.System.PrivateProfileString("",_ "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", _ "AppData") & "\Microsoft\Signatures\" objWord.Quit If Item.UserProperties("rffolder name") "" Then strDocsDir = strDocsDir & Item.UserProperties("rffolder name") & "\" End If Dim fso Dim fils Dim fil Dim fldr Dim filecount Dim filename 'Set the flder object to point to the folder that I am interested in set fso=createobject("Scripting.FileSystemObject") Set fldr = fso.GetFolder(strDocsDir) Set fils = fldr.Files 'Print the name of the file that file object fil is pointing to. filecount = 0 For Each fil In fils filecount = filecount + 1 If filecount = 1 Then Exit For Next filename = fil.Name strAttPathName = strDocsDir 'Add the signature attachment to the message item. Set attmts = item.Attachments attmts.Add strAttPathName & filename

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish