Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert signature in e-mail created by Access

Status
Not open for further replies.

PortyAL

Technical User
May 13, 2005
126
GB
Hi

My apologies in advance for the length of this post!

I use the following code to create e-mails from access.

Code:
Rem On Error GoTo nofiles

Dim strbody As String
Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem
Dim MailTo As String
Dim attnameDR As String
rem Dim fso As Object 'Scripting.FileSystemObject
rem Dim ts As Object 'Scripting.TextStream
rem Dim strSignFile As String

rem strSignFile = "C:\Signatures\untitled.htm"
rem Set fso = CreateObject("Scripting.FileSystemObject")
rem Set ts = fso.Opentextfile(strSignFile, 1)   'ForReading
rem readsignature = ts.ReadAll
rem ts.Close
rem Set ts = Nothing
rem Set fso = Nothing

attnameDR = Forms![form1]![docfolder] & "\" & Forms![form1]![Job] & " Draft Report.doc"

'**creates an instance of Outlook
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

MailTo = Forms![form1]![Contact]

strbody = strbody & Chr(13) & Chr(10)
strbody = strbody & "<p><FONT face=Tahoma><font size=2>" & Forms![form1]![ManagerFirstName] & "</p>"
strbody = strbody & "<p>As discussed please find attached the Draft Report for the <b>" & Forms![form1]!Job & "</b> audit completed by " & Forms![form1]!AuditorName & ". I would appreciate it if you could complete the Action Plan at Appendix 1 of the Draft Report and return it to me by <b>" & Forms![form1]![respdueby] & "</b>.</p>"
strbody = strbody & "<p>I would like to thank you and your staff for the help and co-operation received during the audit.</p>"
strbody = strbody & "<p>If you require any further information, please contact us.</p>"
strbody = strbody & "<p>Regards</p>"
rem strbody = strbody & readsignature

'***creates email
 With objEmail
     .To = Forms("form1").Controls("Contact").Value
     .CC = Forms("form1").Controls("empname").Value
     .Subject = "Draft Internal Audit Report - " & Forms![form1]!Job
     .BodyFormat = olFormatHTML
     .htmlBody = strbody
     .Importance = olImportanceHigh
     .ReadReceiptRequested = True
     .Attachments.Add attnameDR
     .Display
     Rem .SaveAs Forms("form1").Controls("docfolder").Value & "\Email - Draft Report.htm", olHTML

 End With

Set objEmail = Nothing

Exit Sub

nofiles:
MsgBox "Draft Report is not present", vbInformation, "Cannot create e-mail"
Exit Sub

norespdate:
MsgBox "Response Due By not completed.", vbInformation, "Cannot create e-mail"
Exit Sub

End Sub

My query concerns inserting my signature at the end of the e-mail. I tried using the following code to read my signature and add it on to the body of the e-mail:

Code:
Dim fso As Object 'Scripting.FileSystemObject
Dim ts As Object 'Scripting.TextStream
Dim strSignFile As String

strSignFile = "C:\Signatures\untitled.htm"
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.Opentextfile(strSignFile, 1)   'ForReading
readsignature = ts.ReadAll
ts.Close
Set ts = Nothing
Set fso = Nothing

The problem with this is that my signature includes a scan of my actual physical signature, but all the recipient gets is a box where the signature should be.

If I create the email without reading my signature and then insert it manually, all works fine. Is there a command or commands that can be used in the "With objEmail" to automatically insert a signature? Even something as basic as a SendKeys statement?

Thanks in advance

AL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top