USING OEAPI IN AN MS ACCESS VBA APPLICATION

11 views
Skip to first unread message

NUCCIO

unread,
Apr 5, 2010, 1:47:40 PM4/5/10
to Nektra OEAPI Support
This is to clarify better the problem I tried to describe in my
previous post on the same subject..
The problem could be easily solved if I could use MS Office Outlook
2007 in a remote desktop environment on Windows Server 2003. As an
example, the following code creates and displays a message using a
specific MS Office Outlook account (stAcct):
==================================================================================
Sub PreparaMail(stSubj As String, stTo As String, stCC As String,
stAcct As String)
Dim ol As Object
Dim oAcct As Outlook.Account
Dim ns As Outlook.Namespace
Dim newMail As Object
On Error GoTo PreparaMail_ERR
Set ol = New Outlook.Application
Set ns = ol.GetNamespace("MAPI")
ns.Logon , , True, True
Set oAcct = ns.Accounts(stAcct)
Set newMail = ol.CreateItem(Outlook.olMailItem)
'(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem)
Set newMail.SendUsingAccount = oAcct
With newMail
.Subject = stSubj
.To = stTo
.cc = stCC
.Display
End With

PreparaMail_END:
ns.Logoff
Set newMail = Nothing
Set ns = Nothing
Exit Sub
PreparaMail_ERR:
fumERR 0, "Prepara Mail", Err.Number, Err.Description
Resume PreparaMail_END
End Sub
==================================================================================
Unfortunately I could not find in the OEAPI Classes documentation
anything similar to the "SendUsingAccount" property.
An alternative could be found if it were possible to programmatically
change the Outlook Express Identity (and therefore the default Mail
Account) before launching the SendMail Sub that I reported in my
previous post, repeated hereafter:
==================================================================================
Sub SENDMail(stAddress As String)
Dim stMailTo As String
On Error GoTo Email_ERR
If Len(stAddress) = 0 Then
If FumDom("Missing e_Mail address, do you want to input it
now?", , , "EMAIL ADDRESS!!") = MsgResCancel Then Exit Sub
stAddress = InputBox("INPUT EMAIL ADDRESS")
If Len(stAddress) = 0 Then Exit Sub
End If
stMailTo = "Mailto:" & stAddress
Call ShellExecute(0, "open", stMailTo, vbNullString, vbNullString,
1)
EMAIL_Out:
Exit Sub
Email_ERR:
fumERR 0, "SEND MAIL", Err.Number, Err.Description
Resume EMAIL_Out
End Sub
==================================================================================
Unfortunately again, in the OEAPI documentation I could only find the
function GetCurrentIdentity but not a specular function
SetCurrentIdentity.
As things stand, in absence of any suggestion from this Support Group
I will have to conclude that Nektra OEAPI doesn't offer any viable
solution to my problem.
I hope somebody will reply to my post with some useful suggestion.

Nektra OEAPI Support

unread,
Apr 6, 2010, 4:59:01 PM4/6/10
to nektra...@googlegroups.com
Hi Nuccio,

OEAPI does not support specifying which account should send the message.
Please browse the group archive for more information about this.

Thank you for contacting Nektra's OEAPI Support.

Regards,

Scott

--
Nektra Advanced Computing
http://www.nektra.com

Reply all
Reply to author
Forward
0 new messages