mailto button

mailto button

Anonymous
Not applicable
316 Views
2 Replies
Message 1 of 3

mailto button

Anonymous
Not applicable
Hi I would like my button when selected to open Outlook and put a email address in, similiar to 'mailto' in HTML Thanks for the help Max
0 Likes
317 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Max, I just wrote the following for one of my apps. Public Sub CreateMessage(sTo As String, sSubject As String, sMessage As String, Optional bSend As Boolean) Dim oOL As Outlook.Application Dim oEmail As Outlook.MailItem On Error Resume Next Set oOL = GetObject(, "Outlook.Application") If oOL Is Nothing Then Set oOL = CreateObject("Outlook.Application") If oOL Is Nothing Then MsgBox "Could not start Outlook. Please start Outlook and try again." GoSub Cleanup End If End If Set oEmail = oOL.CreateItem(olMailItem) With oEmail .To = sTo .Subject = sSubject .Body = sMessage .Display If bSend = True Then .sEnd End With Cleanup: Set oOL = Nothing Set oEmail = Nothing End Sub You need to add a reference to the Microsoft Outlook X.x (your version) Object Library to your project. This was just a first run, but it did exactly what I wanted it to do. To hook it up to a button, you'd need to use something like: ^c^c(vl-vbarun "c:/path/myproject.dvb!CreateMessage"); Ben Rand CAD Manager CEntry Constructors & Engineers brand@centry.net "Max" wrote in message news:40d2087c$1_3@newsprd01... > Hi > > I would like my button when selected to open Outlook and put a email address > in, similiar to 'mailto' in HTML > > Thanks for the help > > Max > >
0 Likes
Message 3 of 3

Anonymous
Not applicable
Try this - late bind so you don't need to worry about a reference! Public Sub CreateMessage(sTo As String, sSubject As String, sMessage As String, Optional bSend As Boolean) Dim oOL As Object Dim oEmail As Object On Error Resume Next Set oOL = GetObject(, "Outlook.Application") If oOL Is Nothing Then Set oOL = CreateObject("Outlook.Application") If oOL Is Nothing Then MsgBox "Could not start Outlook. Please start Outlook and try again." GoSub Cleanup End If End If Set oEmail = oOL.CreateItem(olMailItem) With oEmail .To = sTo .Subject = sSubject .Body = sMessage .Display If bSend = True Then .sEnd End With Cleanup: Set oOL = Nothing Set oEmail = Nothing End Sub -- Mike ___________________________ Mike Tuersley CADalyst's CAD Clinic Rand IMAGINiT Technologies ___________________________ the trick is to realize that there is no spoon...
0 Likes