 |
Creatica Level: Protégé
 Registered: 01-02-2007 Posts: 4
|
Email from VB
I am trying to send an email with VB but am getting stuck on the dim. It stops at the first line:
dim olapp as Outlook.Application
and returns the message: User-defined type not defined
Is there a component or reference I need to add to my program in order for this to work? I have a different way of getting the email ready, by using:
'ShellExecute ByVal 0&, vbNullString, str, vbNullString, "C:\", SW_SHOWNORMAL
with my parameters but I can not figure out if there is a way for it to automatically send. So I'm looking through previous posts and I came across the example:
olmsg.Recipients.Add "Recipients"
olmsg.Attachments.Add "c:\test.txt"
olmsg.Subject = "Subject"
olmsg.Body = "Body"
olmsg.send
I see it should be easy to send a "send" command but I'm getting hung up. Any ideas? Thanks!
|
|
28-02-2007 at 05:47 PM |
|
|
humberto Level: VB Lord
 Registered: 13-01-2005 Posts: 246
|
Re: Email from VB
May this help
Private 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
Private Sub Command1_Click()
ShellExecute hWnd, "open", "mailto:" & "Testtmail.@test.com", vbNullString, vbNullString, SW_SHOW
End Sub
|
|
|
01-03-2007 at 07:56 AM |
|
|
|
|
 |
 |