E Mail using another outlook account

monplankton

Registered User.
Local time
Today, 06:38
Joined
Sep 14, 2011
Messages
83
I'm using access 2003 and need to select a different profile when E mailing reports, central mailbox, from my database. Has anyone got any ideas how I could right the code to manage this?I'm thinking I need to do it when I open the outlook application? Any help?
 
Hello,

Can this piece of code can help you? (I found it on the web)

Code:
Function Set_Account(ByVal AccountName As String, M As Outlook.MailItem) As String

Dim OLI As Outlook.Inspector
Dim strAccountBtnName As String
Dim intLoc As Integer
Const ID_ACCOUNTS = 31224

Dim CBs As Office.CommandBars
Dim CBP As Office.CommandBarPopup
Dim MC As Office.CommandBarControl

Set OLI = M.GetInspector
If Not OLI Is Nothing Then
Set CBs = OLI.CommandBars
Set CBP = CBs.FindControl(, ID_ACCOUNTS)
If Not CBP Is Nothing Then
For Each MC In CBP.Controls
intLoc = InStr(MC.Caption, " ")
If intLoc > 0 Then
strAccountBtnName = Mid(MC.Caption, intLoc + 1)
Else
strAccountBtnName = MC.Caption
End If
If strAccountBtnName = AccountName Then
MC.Execute
Set_Account = AccountName
GoTo Exit_Function
End If
Next
End If
End If
Set_Account = ""

Exit_Function:
Set MC = Nothing
Set CBP = Nothing
Set CBs = Nothing
Set OLI = Nothing
End Function
 

Users who are viewing this thread

Back
Top Bottom