Add a Signature to an Email Message - VBScript

''VBScript to add a signature to a mail message''Retrieve the Documents folder from the Registry

ITPro Today

July 28, 2003

1 Min Read
ITPro Today logo in a gray background | ITPro Today

'*********************************************'VBScript to add a signature to a mail message'*********************************************'Retrieve the Documents folder from the RegistrySet objWord = Item.Application.CreateObject("Word.Application")strDocsDir = objWord.System.PrivateProfileString("",_"HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionExplorerShell Folders", _"AppData") & "MicrosoftSignatures"objWord.QuitIf Item.UserProperties("rffolder name") "" ThenstrDocsDir = 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.NamestrAttPathName = strDocsDir'Add the signature attachment to the message item.Set attmts = item.Attachmentsattmts.Add strAttPathName & filename

Read more about:

Microsoft
Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like