VB 6 sp5
References
Microsoft Outlook 10.0 Object Library
Microsoft Outlook View Control
Error Message "Argument not optional" Appears and highlights the "call SendMail" for the error
I'm trying to send an email using VB, but with no success.
I cut and pasted the code into my app.
Private Sub cmdSend_Click()
Call SendMail
End Sub
Public Sub SendMail(tSubject As String, tBody As String)
'***********************
'Description: Uses the outlook object to create and send a mail using the passed parameters of tsubject,tbody and tTo
'***********************
Dim oItem As Outlook.MailItem
Dim oitems As Items
Set oOutlook = New Outlook.Application
Set oitems = objInbox.Items
Set oItem = oOutlook.CreateItem(olMailItem)
'
With oItem
tto "Address@juno.com"
tBody = "Testing 1...2...3..."
tSubject = "Test"
.To = tto
.Body = tBody
.Subject = tSubject
.send
End With
References
Microsoft Outlook 10.0 Object Library
Microsoft Outlook View Control
Error Message "Argument not optional" Appears and highlights the "call SendMail" for the error
I'm trying to send an email using VB, but with no success.
I cut and pasted the code into my app.
Private Sub cmdSend_Click()
Call SendMail
End Sub
Public Sub SendMail(tSubject As String, tBody As String)
'***********************
'Description: Uses the outlook object to create and send a mail using the passed parameters of tsubject,tbody and tTo
'***********************
Dim oItem As Outlook.MailItem
Dim oitems As Items
Set oOutlook = New Outlook.Application
Set oitems = objInbox.Items
Set oItem = oOutlook.CreateItem(olMailItem)
'
With oItem
tto "Address@juno.com"
tBody = "Testing 1...2...3..."
tSubject = "Test"
.To = tto
.Body = tBody
.Subject = tSubject
.send
End With