A
Alastair MacFarlane
Dear All,
I am trying to send an email through Outlook NOT through the default Mailbox
but through another mailbox that I have total rights to. We are using Outlook
2000 and Access 97.
I am using the code below but it does not work:
Private Sub Command0_Click()
Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Dim oFolders As MAPIFolder
Dim oInbox As MAPIFolder
Dim onMAPI As NameSpace
Set onMAPI = objOutlook.GetNamespace("MAPI")
Set oFolders = onMAPI.Folders("Mailbox - Balfour Helen")
Set oInbox = oFolders.Folders("Inbox")
'Check whether I have the correct Mailbox (and I do!)
MsgBox oInbox.Items.Count
'************* error here *************
Set objMail = oInbox.Items.Add(olMail)
With objMail
.To = "(e-mail address removed)"
.Subject = "Subject of mail message"
.Body = "Body of mail message"
.Send
End With
End Sub
It errors with the line "Set objMail = oInbox.Items.Add(olMail)".
?err.Number
-382271401
?err.Description
Could not complete the operation. One or more parameter values are not valid.
Can someone please advise me how to send an email from a specified
non-default mailbox.
Thanks again.
Alastair MacFarlane
I am trying to send an email through Outlook NOT through the default Mailbox
but through another mailbox that I have total rights to. We are using Outlook
2000 and Access 97.
I am using the code below but it does not work:
Private Sub Command0_Click()
Dim objOutlook As New Outlook.Application
Dim objMail As MailItem
Dim oFolders As MAPIFolder
Dim oInbox As MAPIFolder
Dim onMAPI As NameSpace
Set onMAPI = objOutlook.GetNamespace("MAPI")
Set oFolders = onMAPI.Folders("Mailbox - Balfour Helen")
Set oInbox = oFolders.Folders("Inbox")
'Check whether I have the correct Mailbox (and I do!)
MsgBox oInbox.Items.Count
'************* error here *************
Set objMail = oInbox.Items.Add(olMail)
With objMail
.To = "(e-mail address removed)"
.Subject = "Subject of mail message"
.Body = "Body of mail message"
.Send
End With
End Sub
It errors with the line "Set objMail = oInbox.Items.Add(olMail)".
?err.Number
-382271401
?err.Description
Could not complete the operation. One or more parameter values are not valid.
Can someone please advise me how to send an email from a specified
non-default mailbox.
Thanks again.
Alastair MacFarlane