Bring Outlook 'Select Names Dialog' to front when selecting from Access 2010 form
Hi,
I have written the following code to open the Outlook 2013 'Select Names Dialog' with a command button called 'btnTo' from an Access 2010 form, this code works fine to display the dialogue box but it is usually hidden and the user has to 'click' the icon on the task bar to show the dialogue box. I know that there is an API that will bring the dialogue box to the front but I have no idea on how to code the API to do this.
Please can anyone help?
Any help would be much appreciated.
Regards,
Syd.
Hi,
I have written the following code to open the Outlook 2013 'Select Names Dialog' with a command button called 'btnTo' from an Access 2010 form, this code works fine to display the dialogue box but it is usually hidden and the user has to 'click' the icon on the task bar to show the dialogue box. I know that there is an API that will bring the dialogue box to the front but I have no idea on how to code the API to do this.
Please can anyone help?
Code:
Private Sub btnTo_Click()
On Error GoTo Err_btnTo_Click
Dim olkApp As Outlook.Application
Dim olkSes As Outlook.NameSpace
Dim olkSND As Outlook.SelectNamesDialog
Dim olkRecipient As Outlook.Recipient
Dim olkTo As String
Dim x As Integer
Set olkApp = CreateObject("Outlook.Application")
Set olkSes = olkApp.Session
Set olkSND = olkSes.GetSelectNamesDialog
With olkSND
.AllowMultipleSelection = True
If .Display Then
For Each olkRecipient In .Recipients
x = x + 1
olkTo = olkTo & .Recipients(x) & "; "
Next
End If
End With
Me!txbTo.Value = olkTo
Set olkSND = Nothing
Set olkSes = Nothing
Set olkApp = Nothing
Exit_btnTo_Click:
Exit Sub
Err_btnTo_Click:
MsgBox Err.Description
Resume Exit_btnTo_Click
End Sub
Any help would be much appreciated.
Regards,
Syd.
Last edited: