Link to home
Start Free TrialLog in
Avatar of marrick13
marrick13

asked on

Manually entering values in modeless userform listbox after clicking in the document

I have a userform that I open modelessly because I need to access the document. Its listbox lists all the page numbers of the document, and when I first load the form, I can manually enter a page number in that listbox (and it navigates to that page). But as soon as I click anywhere in the document and then return to that listbox, I can no longer manually enter anything in it. This is not a problem if I load the userform modally, but since is a "GoTo" macro that navigates to and stores pages, its usefulness would be greatly reduced if I had to close the form each time I wanted to enter a page number.

Is there some way around this?
Goto_Page-Application--Test-Aug-31-.docm
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

It seems to be working OK for me (Win 10, Word 2016)
Avatar of marrick13
marrick13

ASKER

Hi again, Graham,

I'm running Word 2010 and Windows 7, but I don't see how the version would make a difference. In case you're not understanding exactly what my issue is, I've prepared a short document ("GoTo Macro Picklist Limits") with screenshots. The picklist definitely locks whenever I access the document and I can either only close the form and reopen it or click one of the spin buttons - that enables me to manually type in the picklist after I've clicked in the document. I'm looking for a way to unlock the picklist (or to keep it unlocked) whenever I access the document itself.

I've also re-attached the macro document but with 45 pages of text, just so there are multiple pages for navigating.
GoTo-Macro-Picklist-Limits.docx
Goto_Page-Application--Test-Sept-2-.docm
Hi Rick, Sorry to the long delay, I have been having PC problems

Yes you are right, I didn't understand the problem. I interpreted 'manually', as 'not programmatically',  while you were expecting to enter using the keyboard, not just with the mouse.

I was able to enter digits into the combo with the keyboard and indeed it stopped when selecting the document. But I couldn't consistently get it to start again.

At the moment I think it is a bug. But the bug is that you can enter anything at all using the Style setting for the control. It is DropDownList . I believe the DropDownCombo option will do what you want.
Graham, no need to apologize; there's no hurry. I've been using this macro for a while knowing about this limitation. But I recently decided to do something about it. The reason I made the listbox a DropDownList was so whatever I entered overwrote the contents. In other words, the way it works when you first load the form is exactly what I wanted. I just wanted that functionality to continue after clicking in the document.  The DropDownCombo does indeed allow manual entry after clicking in the document, but then it appends what's in the box (which I don;t want). Since it appends, I can type a large number that will cause an overflow error if that number gets too large. So I just added code to prevent that but I still have the issue of what I manually type appending instead of overwriting the listbox value.

Can you think of a way to have the DropDownCombo yet make manual entry overwrite the listbox values? I've attached a revised version; the code change I made was to the 'Private Sub CheckcmbPages' module.
Goto_Page-Application--Test-Sept-4-.docm
So is there a way to have the DropDownCombo yet make manual entry overwrite the listbox values?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.