opening email with default signature

G

Guest

I have successfully created some code that enables me to double click an
email address in a field on a form wich opens our default email programme
(Outlook) and drops the address into the To: field. It also adds a subject
line and some copy to the body if this is passed to the proceedure.

However I would like to always use the default signature that we have set
which shows fine when working directly in Outlook.

Any suggestions?

Code so far is:

Private Sub txtEmail_DblClick(Cancel As Integer)
SendEmail (txtemail)
End Sub

Public Sub SendEmail(Optional strEmailAdd As String, Optional strSubject As
String, Optional strBody As String)

Dim oOutlook As Outlook.Application
Dim oNameSpace As Outlook.NameSpace
Dim oMailItem As Outlook.MailItem

Set oOutlook = New Outlook.Application
Set oNameSpace = oOutlook.GetNameSpace("MAPI")
Set oMailItem = oOutlook.CreateItem(olMailItem)

Dim sEmailString As String
Dim sSubject As String
Dim sBody As String

sEmailString = strEmailAdd
sSubject = strSubject
sBody = ReturnUserName

With oMailItem
.To = sEmailString
.Subject = sSubject
.Body = strBody
End With

oMailItem.Display

Set oOutlook = Nothing
Set oNameSpace = Nothing
Set oMailItem = Nothing

End Sub
 
G

Guest

You can find the (outlook-)signature in:
C:\Documents and Settings\" & Environ("username") & _
"\Application Data\Microsoft\Signatures\
as txt- or htm-file
for instance: "Mysignature.txt" (the name the user was given to his/her
signature)

You can import the signature with:
'==
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(Mysignature.txt).OpenAsTextStream(1, -2)
SignatureText = ts.readall
ts.Close
'==

Then add SignatureText to the body text


sBody= "Your text..." & Chr(13) & Chr(13) & SignatureText
 
G

Guest

Thanks Dick,

That worked perfectly for inserting a signature saved in a txt file and is
certainly good enough to go with.

However when we created our signature file we also used some small pictures
to brand it, along with formatting the font a bit and the process has
therefore created txt, rtf and html files. The icing on the cake would be to
use the html file (or at least the rtf file) however when I substitute these
in the proceedure we end up with html mark up language in place of the
signature.

Any thoughts how to get round that?
 
G

Guest

See the helptext about HTMLBody .

.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><H2>The body of this message will appear in
HTML.</H2><BODY>Enter the message text here. </BODY></HTML>"



(I can not try it at home, using OutlookExpress)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top