How to Send Email to an Address in a Label (Text Box).
Posted on July 10, 2011
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 'Internet - How to Send Email to an Address in a Label (Text Box). Public Const SW_SHOW = 1 Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _ ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long 'Create this Routine Sub Navigate(frm As Form, ByVal WebPageURL As String) Dim hBrowse As Long hBrowse = ShellExecute(frm.hwnd, "open", "MailTo:" + WebPageURL, "", "", SW_SHOW) End Sub 'Put this line in the Label(Or other Controls) CLICK EVENT Call Navigate(Me, Label1.Caption) 'Put this line in the Label MOUSEMOVE EVENT - This may be left out if you are 'using another type of control! Label1.ForeColor = &H8000000D 'Put this line in the MOUSEMOVE EVENT of every other control and the form Label1.ForeColor = &H80000012 'REMEMBER TO MAKE SURE THAT YOU USE EMAIL ADDRESSES!! 'The best thing would be to do a search of the string sent to the function and 'test that it contains an "@" symbol. |