GetSelectNamesDialog Pre-fill search box

Status
Not open for further replies.

AaronSt

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Diane or other experts out there, Is there a way to fill-in the left-most search box of the GetSelectNamesDialog through a VBA method or MAPI property or other?

I would like to add a convenience to the user for the case where the GetSelectNamesDialog pops up: I see in Outlook SelectName dialog that it will fill in the "search" name to filter the list. I would like to do this with the user last name. Can I set a property of the dialog or send a string to it as the initial search? How do they do it in Outlook? See picture.


Thank you in advance,
Aaron
 

AaronSt

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Thank you Michael. I'm glad I brought this to another forum. The solution looks quite complex but I understand what it is trying to do and why. Too bad that functionality isn't part of the selectnamesdialog already.

I tried running the code and ran into this error on the call of SetTimer: "Invalid use of AddressOf operator.". I am using 64-bit windows. Does that matter? Have you been able to get past this one somehow?
 

AaronSt

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Figured it out... All the code in Michael's link needs to be in a new module (as stated in the page). I had it in "ThisWorkbook".
 

AaronSt

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Still not working fully for me. It appears the timer is not firing until after the modal GetSelectNamesDialog is closed. After, the timer fires and the rest of the process continues. Since the GetSelectNamesDialog is closed, however, it does not find the right window and exits out. I confirmed that the functionality works however by leaving another SelectNamesDialog open in Outlook that the macro found and pre-filled successfully. What am I missing to get the timer to fire while the SelectNamesDialog is open?
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
then most likely you haven't copied the code as it is but do call Display before calling SetTimer.
 

AaronSt

New Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I think it's because the code was intended for Outlook and I am running it from Excel. As a result, the code stops waiting for the modal outlook application dialog to close before it can continue, or at least that is my guess. I copied the code as is.
 

R Garnett

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Office 365 Exchange
then most likely you haven't copied the code as it is but do call Display before calling SetTimer.
Michael Bauer: One thing that's stopping the code working as-is is that 'Private m_PrefillWithThis As String' has been declared in part 1, but in part 2 the name of the variable has been changed to 'm_FindThisName' so it doesn't find it. I can confirm that the code works properly in Outlook 2013 once the variable name is resolved. Possibly it would still work without correction if user does not set Option Explicit, I don't know. Also is the code yours? I like to give credit where possible. If so many thanks! Robin
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Thanks Robin, I´ve corrected the sample. And yes, it´s my code. If you want to share it, please add a link to the page you´ve got it from.
 

R Garnett

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Office 365 Exchange
Thanks Robin, I´ve corrected the sample. And yes, it´s my code. If you want to share it, please add a link to the page you´ve got it from.
Thanks Michael. I probably wont share it but have added the details to my copy of the code in case it does ever get shared. Also if you or anyone else is interested I have added code to click the 'more columns' and 'go' buttons in the dialog as well as prefilling the box:

Add Declaration:
Public Declare Function FindWindowEx Lib "User32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long

Modify Prefill... sub (changed dimensioning a bit, added a bit):
Private Sub PrefillSelectNames()
Dim hndDialog As Long
Dim hndTextBox As Long
Dim hndButton As Long
Dim OK As Boolean

hndDialog = GetDesktopWindowA
hndDialog = FindChildWindowText(hndDialog, m_DialogCaption)

If hndDialog Then
hndTextBox = FindChildClassName(hndDialog, "RichEdit20W")
If hndTextBox Then
SetText hndTextBox, m_PrefillWithThis
OK = True
'******************* Added this bit...

'Clicks 'More Columns'
hndButton = FindWindowEx(hndDialog, ByVal 0&, "Button", "Mo&re columns")
If hndButton <> 0 Then
Call SendMessageByStringA(hndButton, LMouseButton, 0, 0)
End If
'Clicks 'Go'
hndButton = FindWindowEx(hndDialog, ByVal 0&, "Button", "&Go")
If hndButton <> 0 Then
Call SendMessageByStringA(hndButton, LMouseButton, 0, 0)
End If

'********************
End If
End If

If OK = False Then
MsgBox "window not found"
End If
End Sub
 

R Garnett

New Member
Outlook version
Outlook 2013 32 bit
Email Account
Office 365 Exchange
Sorry forgot, also have to declare:
Public Const LMouseButton = &HF5&
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
S Creating Email - Selecting Pre-Defined Text Using Outlook 2
O "Pre-filled" text in each new message Using Outlook 2
S Pre populate subject + body + attachment to already open email in outlook 2007 Using Outlook 2
F VBScript to add pre defined text Using Outlook 5
L Trying to install pre-req for Exchange SP1 Exchange Server Administration 17
L Exchange 2010 SP1 Pre-Req error Exchange Server Administration 2
D outlook pre-view pane changed yesterday Using Outlook 4
S Microsoft India Pre-Sales Support Feedback Exchange Server Administration 1
S Pre-Deployment Analyzer Exchange Server Administration 8
S 2003: Issue dragging & dropping a Task or Email to pre-selected Cal. timeslot Using Outlook 3
T Management Tools Pre Requisites Exchange Server Administration 2
S Pre SP1 using Managed Folders Policy - Post SP1 what do I do? Retention Policy? Exchange Server Administration 2
R unlocking pre-2003 outlook.pst file that has reached its maximum Using Outlook 1
C Receiving emails "pre-tagged" with Task1 and Task2 - OL 2007 Using Outlook 2
M Edge Server pre-reqs installed IIS using powershell Exchange Server Administration 4
P Error installing Exchange Pre-deployment Analyzer Exchange Server Administration 1
S Catch events from pre-existing buttons in Outlook 2007 Outlook VBA and Custom Forms 7
J User defined fields with pre-defined values Outlook VBA and Custom Forms 3
L Quick step to fill custom field Outlook VBA and Custom Forms 1
K Reducing data input, how to auto-fill Account form info into Contact form BCM (Business Contact Manager) 0
P Outdated auto-fill choices in various fields Using Outlook 2
L Drop down menu box in Office 2003 are too small. I cannot see all the information to fill out serve Using Outlook 2
E I am trying to extract the email adress's i have in outlook. These are not saved 'contacts' these are ones from auto fill. When i open up an email, an Using Outlook 1
R Microsoft Outlook 2010 Auto Fill Feature Using Outlook 1
F Need to fill in the password each time when log into outlook Using Outlook 3
U Email address auto-fill Using Outlook 1
Z Qucik Fill in E-mail Is there a size limit? Using Outlook 1
T Auto fill of e-mail addresses is empty Using Outlook 3
M how to fill 'Microsoft exchange server name' and 'user name' Using Outlook 1
S When creating various form emails, have Outlook fill in specific phrases/paragraphs based on a couple of words. Using Outlook 1
F Need to fill an application and mail it. Using Outlook 1
J Outlook is not recognized as the default mail provider or the current Mail client cannot fill the me Using Outlook 2
V Fill window Using Outlook 1
M auto-fill email addresses are out of date Using Outlook 1
C auto fill email address from address book in Outlook Mail Using Outlook 6
D Re: How to delete an old email address from auto-fill Using Outlook 0
T How do I delete an old email address that shows up during auto-fill of the To: field but does not appear in my Address Book? Using Outlook 0
Similar threads





































Top