Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Yes done that, it does now open in outlook correctly
Just now need to set which account on this specific event
I used to use SendUsingAccount ?
where intAccount is the order of the accounts in my Outlook.Code:.SendUsingAccount = objOutlook.Session.Accounts.Item(intAccount)
Alternatively use this to find out which account index is your required account. I have this in Outlook, but should work in Access?
Code:Public Function ListEMailAccounts(AcctToUSe As String) As Integer Dim outApp As Object Dim i As Integer Dim AccNo As Integer Dim emailToSendTo As String Set outApp = CreateObject("Outlook.Application") 'emailToSendTo = "epsteel@gmail.com" 'put required email address AccNo = 1 'if smtp address=email we want to send to, acc no we are looking for is identified For i = 1 To outApp.Session.Accounts.Count 'Uncomment the Debug.Print command to see all email addresses that belong to you 'Debug.Print "Acc name: " & OutApp.Session.Accounts.Item(i) & " Acc number: " & i & " , email: " & OutApp.Session.Accounts.Item(i).SmtpAddress 'If OutApp.Session.Accounts.Item(i).SmtpAddress = emailToSendTo Then If outApp.Session.Accounts.item(i).DisplayName = AcctToUSe Then AccNo = i Exit For End If Next i ListEMailAccounts = AccNo Set outApp = Nothing End Function
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
Thank you WGM, i know what you mean by using intAccout as Send UsingAccout(1) is primary (2) is next account etc...
Will read through your Function tonight to see what i can pick up from it
Kindest
Would be safer to use the Account Name, as if you move the accounts up or down, the index will change?, plus if another user needs to use it, their account order might not match yours?
So use that function to return the index number of the account required?
Please use # icon on toolbar when posting code snippets.
Cross Posting: https://www.excelguru.ca/content.php?184
Debugging Access: https://www.youtube.com/results?sear...bug+access+vba
I imagine you have a reason for this approach but I admit I'm a bit baffled why anyone would open an email via vba and insert a mailto link in an email they don't intend to send (as per post 6) just to get a list of some sort.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.
@Micron, yes i though using a list is much less messy than bringing an array of results to an email body then adding an email link within the body to send email form, that was the focus
populating a list with the same results then add new email for the email address on the selected row number, that would be an easy answer i guess ?