Client Form with Email & WebAddress? Click to access email or web?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good Day,

I have a client form with both email & web addresses. I would like to be
able to click on the email address and it would open my Outlook, and if I
click on the web address, it would open that address in my default browser?

is this possible without any heavy coding?

Thanks, in advance...

Brook
 
To open a web address in your default browser all you have to do is set the
Is Hyperlink property (Format tab of Properties window) of the Text Box
control on your Form to "Yes".

The email issue, to the best of my knowledge, requires some "heavy coding".
If you want some more info post a reply requesting it.

Good luck
 
Thanks for the information, it totally slipped my mind about adding a
hyperlink property.

And if you don't mind, I would like to see the email coding and see if it
will be worth the work just for an email.

Thanks ...

Brook
 
Brook,

Here is some simple code that will create an email message. I use it in the
click event of a command button. Depending on the version of Outlook you are
using you will probably encounter the object model guard issues which are
certainly quite complex and beyond the scope of this post. Keep in mind that
this is the tip of the iceberg and you need to do some homework to use this
effectively.

Before using this code be sure to add a reference to the Outlook Object
Library (VBA - Tools, Referencs - Check Microsoft Outlook ??? Object Library)

Private Sub cmdEmail_Click()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the "To" recipient to the message.
Set objOutlookRecip = .Recipients.Add(Me.Email)
objOutlookRecip.Type = olTo

' Set the Subject, Body, and Importance of the message.
.Subject = "My Subject"
.Body = "The main body of the email"
.Importance = olImportanceHigh 'olImportanceLow, olImportanceNormal

'Make the message visible
.Display
End With

Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub


Good Luck!!
 
Back
Top