Hi,
Here is a code given by someone for sending a simple mail, but the code is giving a compiler error "User-defined type not defined", someone suggested to add reference of Microsoft Outlook xxx type library where xxx is the version of Outlook i am using. But still, the problem is same.
So, can anyone correct it or just give me another code for sending a simple mail.
Hope u people help.
Thanx
Here is the code :
Private Sub Command1_Click()
Dim olapp As New Outlook.Application
Dim olMail As Outlook.MailItem
Dim olAttachment As Outlook.Attachments
' Create a new mail object form the
' Outlook98 Application object
Set olMail = olapp.CreateItem(olMailItem)
Set olAttachment = olMail.Attachments
olMail.To = "[email protected]"
olMail.Subject = "Test Message"
olMail.Body = "Hello, this is a test message"
' olMail.Attachment.Add "FileName1"
olMail.Send
End Sub


Reply With Quote