opening OUTLOOK 2003

mtagliaferri

Registered User.
Local time
Today, 17:46
Joined
Jul 16, 2006
Messages
550
I have a form with a email field containing a email address, I would like when clicking on it this will open OUTLOOK 2003 placing the email address on the "TO" field
I have looked around but I have not find what I need, I had a VBA code but this will open me a web page instead of OUTLOOK.
Can I get some help!
Thanks
M.
 
myEmail = hello@hmmm.how

doCmd.SendObject , , myEmail

That's the most basic format, assuming that outlook 2003 is the default email client.

You can set references to outlook in your projects references:


Dim objOutlook As Outlook.Application
Dim objEmail As Outlook.MailItem

Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)

txtEmail = hello@hello.com
txtSubject = "lets do lunch"
txtBody = "My place, 8pm!"

With objEmail
.To = txtEmail
.Subject = txtSubject
.body = txtBody
.attachments.Add "c:\mydocs\menu.doc"
End With
 
Hi! thanks for the help, I'm getting closer to what I need to do, I have changed the code as following, now it opens OUTLOOK but it will not show the email address that I have double clicked on and also it does not attach the file mentioned also once I send the email it open a session of internet explorer wich I don't need.
Can you help me further!!!
Thanks
Marco

Private Sub Testo114_Click()

DoCmd.SendObject , , myEmail
Set objOutlook = CreateObject("Outlook.application")
Set objEmail = objOutlook.CreateItem(olMailItem)



With objEmail
.To = txtEmail
.Subject = txtSubject
.body = txtBody
.attachments.Add "c:\Documents and Settings\Marco\Documenti\B Med\Outstanding Commission Advise Slip.pdf"
End With

End Sub
 

Users who are viewing this thread

Back
Top Bottom