Link to home
Start Free TrialLog in
Avatar of Mattyman
Mattyman

asked on

MS Access and outlook profile name

I'm using ms access to send emails and files. I'm using outlook to do this but i also need to change the profile before i send the email. I use the code below but outlook opens before the profile is changed.

I would also like not have the GUI opening and the the whole thing run in the back ground

Help?

Public Function SendEMail(too As String, subject As String, Optional body As String, Optional cc As String, Optional attachment As String, Optional account As String)
 
 
Dim MyOutlook As Outlook.Application
Dim OutlookNamespace As Outlook.NameSpace
Dim MyMail As Outlook.MailItem
 
Set OutlookNamespace = MyOutlook.GetNamespace("mapi")
 
Set MyOutlook = Outlook.Application
 
Set OutlookNamespace = MyOutlook.GetNamespace("mapi")
OutlookNamespace.Logon "arconi"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of YohanF
YohanF
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mattyman
Mattyman

ASKER

great :)