I have certain command buttons on a WorkSheet that I want hidden until a password is entered.
I do this by having an OLEobjects textbox cover them.
The textbox is called "HideButtons" and, when visible, covers certain command buttons.
The textbox has no border and is the same colour as the background.
To see the command buttons, a password is entered and I change the textbox visibility to False.
`ActiveSheet.OLEObjects("HideButtons").Visible = True
ActiveSheet.OLEObjects("HideButtons").Visible = False`
The WorkSheet is protected to ensure users only have access to certain cells and buttons.
When 'HideButtons' is visible, and the command buttons beneath it are hidden 'HideButtons' can still have text entered in to it.
Is there any way I can prevent users entering text into the 'HideButtons' textbox?
Related
I have a simple UserForm containing a prompt, TextInput and 2 buttons (ok & cancel). I want the text input box to be activated when the UserForm opens so that the user can type directly in the box, without having to click there with the mouse first of all. I have looked at this answer:
VBA Make a text box in a UserForm Active when the UserForm activates?
and set the TabIndex of the TextInput to 0.
I have also tried including the line NumericBox.SetFocus to the initialize code. When I set ShowModal to True for the form, both options give the desired outcome, but I really want the form not to be modal. When I set ShowModal to False, the text box is selected (if I hit enter or tab, the selection moves to the OK button (TabIndex 1)), but I can't type straight away in the InputBox - I still need to click with the mouse in the box first.
Is there anyway I can directly type into the input box of a non-modal form as soon as it is opened?
Thanks
I am working on a Word template that has 5 text boxes on a user form (frmMain).
I have a validation routine for each text box, that checks if the correct format is used (i.e. date format in one text box, only allowing the use of numeric values in another, preventing all text boxes left empty and so on). One of my text boxes is called txtNumber.
As of now, one of the validation sub routine fires on txtNumber_Exit.
I also have a command button (cmdHelp) on the same user form that, when clicked, fires the sub routine that shows another user form (frmHelp) that contains a help text on how to use this template.
My problem is that when I click this command button (cmdHelp), the validation routine for the text box "txtNumber" fires. Hence I am stuck with a message (written by me) in a msgbox that says "Number can not be blank", and the frmHelp is not showing.
After this, none of my text boxes have the focus, but my cmdHelp button does.
So if I click the cmdHelp button now, the frmHelp is correctly showing.
But this is messing up the workflow, making the visual experience a bit fuzzy for the user, given the fact that the user gets unnecessary info on invalid input in the txtNumber text box, and that the user needs to click twice on the cmdHelp button.
How can I avoid this?
If you look at the pictures I want the white TextBox to be selected instead of the "Doorgaan" CommandButton. This is an userform. Does anyone know how I can change this?
How i want it :
How it is:
Depending how you want it to interact with the user, you can set different things.
If you don't want user to be able to Tab there then make the button property TabStop to False, otherwise change the order of the Tab by the property TabIndex.
Note you can manually "Activate" a control by the .SetFocus method in your code to make it the current activated control. e.g. TextBox1.SetFocus
You probably have the properties TabIndex = 0 for the Button and 1 for the TextBox. By default the control with the least TabIndex will have the focus. Just set TabIndex = 0 for the TextBox.
I have a few different userforms in Excel 2007 right now and was wondering if I could add a "?" button next to the close symbol in the userform.
Alternatively, is there a way to display some text when I hover over a specific label
The form property "WhatsThisButton" displays the question mark icon next to the close button, but this does nothing without creating an actual help file and assigning it to your form, this is not an easy thing to do. Far easier is to display text as you have described, each control has a "controlTipText" property that will display whatever text you enter in there, when your user hovers their mouse over the control
I have a form with a button which adds text boxes in addition to the 8 text boxes already on the form which are named Textbox1 through 8. When I launch the application and enter the first textbox, I can tab through all the way from 1 - 8.
When I click my button it programmatically creates a textbox below the last textbox with appropriate name such as Textbox9 for the ninth, Textbox10 for the tenth etc.
However when a textbox is added via the button, tabbing through the controls skips from the eighth, to any buttons on the form, and then to the created textbox. Any idea why this happens and how I can resolve it? I've tried google to no avail. Please let me know if you need any code, thank you.
Thanks to Daniel Cook and Grim, I solved my issue by setting the tabindex to match the textbox number, however I also found that setting TabStop to false on the buttons and controls helped me to keep the tab focus within the text boxes.