Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2006

Tip: Looking for answers? Try searching our database.

opening email with default signature

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 02 Dec 2006 20:18 GMT
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
dick - 02 Dec 2006 23:48 GMT
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

Signature

dick

> 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
[quoted text clipped - 44 lines]
>
> End Sub
John - 03 Dec 2006 02:15 GMT
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?

> You can find the (outlook-)signature in:
> C:\Documents and Settings\" & Environ("username") & _
[quoted text clipped - 63 lines]
> >
> > End Sub
dick - 03 Dec 2006 14:19 GMT
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)
Signature

Dick

> Thanks Dick,
>
[quoted text clipped - 77 lines]
> > >
> > > End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.