I've got a userform with multiple pages, and in my userform initialize sub I set the focus to "combobox1" on "page1". When a user is on page2 of the form and clicks my "ClearData" button, which calls the initialize event, I get a run time error 2110 - "Can't move focus... etc" I would like users to have the ability to clear the form and start over no matter what page they are on.
I have a MultiPage userform and I'm adding (4) control buttons - CancelButton, BackButton, ForwardButton and FinishButton. On the first page, those names are fine but when I get to subsequent pages, I get an ambiguous error if I try to name the controls the same. But the code will all be the same. What am I missing? In an example that I have, the user was able to name all the controls with the same name. What setting would control that?
i'm trying to build an app that'll take a user through 5 or 6 steps of a process, with maybe 2-3 substeps in some steps. right now i'm currently using a multipage Userform , but all the tabs make the whole thing look cluttered (even when there's a "Next" button in plain sight). this is especially because i've put each substep as a multipage form under that step's page (multipage forms inside a multipage form). so steps 1-5 would each have their own pages (1-5), then in page 1 you'd have another multipage form (1.a. - 1.c.). is there a way to make it look simpler? i'd like it to look a bit like a Wizard (ie remove all the tabs), but the only way i can think of is to throw a whole heap of controls on one page, and turn them visible/invisible each step of the way.
I have a userform that has a multi page on it with 4 pages. I notice that there is no way to have the individual pages be set to a click event- or none that I see anyways. What I am wanting is for a series of events to happen based on what page the user chooses from the four (like a userform initialize type event).
Excel 2003. User form coding an If statement the "Else" FieldName.Setfocus. The User form has a MultiPage object in addition to the above (setfocus) in a particular field (NOT on the MultiPage object) I want it open to Page2 instead of what ever page it was last closed on. I tried this: MultiPage1.Page2.Enabled
I have been trying to setfocus to any other object on my userform with absolutely no luck at all?
In the code below I open a dialog box to import a text file (with CommandButton1), if no file is selected the user is prompted, this works fine. However it leaves focus to the textbox and the user would have to click on some other object and re-enter the textbox to open the dialog box again.
I'm having some problems with SetFocus on a user form that I am using. Code is Below.
Dim Answer As Variant With cboAccount If .Value "" And .ListIndex = -1 Then Answer = MsgBox(cboAccount.Value & " is not a registered account, would you like to add it?", vbYesNo) If Answer = vbYes Then Load frmNewAccount frmNewAccount.txtAccountName.Value = frmEnterTransaction.cboAccount.Value frmNewAccount.Show If Answer = vbNo Then cboAccount.SetFocus End If End If End If End With End Sub
basically the code asks if the if the answer placed in a cboAccount (combo box) is valid against the list designated to that combo box,
If the entry is not valid a message box appears asking if they would like to add the entry to the valid list if they do not want to do this they can click no and in which case I wan't the focus to be set back to the combo box however currently the setfocus command above does not does not work and the focus is set to the next text box.
I have a project with many textboxes on different forms. On some of the textbox_exits on some of the forms, I call a standard module that checks what the user has input. If the user needs to change the input, a msgbox appears to inform the user the info needs to be changed.
I have tried to use ControlSource, Name etc., But I cannot seem to setfocus back onto which ever textbox the input needs to be changed. I think it has something to do wih the _exit event, but not sure.
I have two userforms. When the user chooses the choice "Other" in the userform frmTradeSickOther, another userform called frmOther will be called. At this point, the user will enter some required comments in a textbox (called txtOther) and click the "Add Comment" button. If the user does not enter anything, a prompt will inform the user to type something in the textbox.
My problems: Once the user clicks okay to the prompt, frmOther is called back. When it's called back, I want the cursor to blink in the textbox. Eventhough I have SetFocus on the textbox, it does not work. I don't know why.How do I prevent the user from just hitting enter (i.e., accepting blank lines as comments) and bypassing the commenting part. The code below accounts for hitting enter once (i.e., one blank line), but not multiple times. How do I do this?
Here is what I have when the user clicks on the "Other" choice in frmTradeSickOther:
Code: Private Sub optOther_Click() Unload Me frmOther.Show frmOther.txtOther.SetFocus 'This gets the cursor to blink in textOther when frmOther is called. End Sub
Here is what I have when the user clicks the "Add Comment" button on frmOther:
Code: Private Sub btnAddComment_Click() On Error Resume Next txtOther.Value = Trim(txtOther.Value) 'This is to make sure spaces aren't accepted as a comment. If Me.txtOther = vbNullString Then Me.Hide MsgBox "Please enter the necessary information.", vbInformation, "Required Field" Me.Show Me.txtOther.SetFocus 'Here is where I set focus on txtOther. Exit Sub End If
'Everything below is to add comments automatically to each cell when a value is changed.
Application.CommandBars("Cell").Controls("Delete Comment").Enabled = True If Not ActiveCell.Comment Is Nothing Then Application.CommandBars("Cell").Controls("Edit Comment").Enabled = True Range(curCell).ClearComments
Have very recently been upgraded to Windows 7 with Excel 2010 at work. On printing out a 10 page doucment, (all of which are landscape format), when vewing print preview, the first page is previewed as landsacpe, but subsequent pages are portrait.
If you change format of 2nd page to landscape all subsequent pages switch to landscape.
Have looked at a similar format document created last month and it behaves exactly the same. Whole document landscape but on print preview only first page is...
I want to have the top half of the userform colored in Red and the bottom half in green. This is not something of much practical use but would be cool and certainly very educational to see if could be done.
I have been searching to see if i could find some snippet Win GDI API codes which i could adapt to Excel and am also asking here maybe someone has seen this done in excel userforms before.
I would like to add a combobox type control that will allow multiple selections. I know that the combobox in the MS Forms Object Library only allows single selections and that the list box is the way to go to allow multiple selections, but I am trying to keep the form as small as possible. I would like to add a control similar to the one used on pivot charts, where the user clicks the dropdown box and can select multiple items. I'm hoping this control is installed with MS Office and just needs a reference to it, but I am open to installing third party controls as well.
With the use of the option buttons,the page needs to made visible or invisible.
Example: on Page one, i have placed radio buttons as page2,Page3&page4.
By default only page 1 should be visible and when we select radio button page2, page2 should become visible or else it should be invisible,when we select radio button page3, page3 should become visible or else should remain invisible.
Private Sub ComboBox1_Change() 'was A, now N DataReport.ComboBox2.Clear If Data5m.FilterMode = True Then: Data5m.ShowAllData Data5m.Range("A1").AutoFilter field:=14, Criteria1:="=" & DataReport.ComboBox1.Value Call FillCombobox(Data5m.Range("X2", Data5m.Cells(Rows.Count, "X").End(xlUp)).SpecialCells(xlCellTypeVisible), DataReport.ComboBox2)
When I view a sheet under Page Break Preview, it shows the Page numbers in the centre of the Page. While I am aware that it would not print the page number I was wondering if there is an option to remove/hide the page numbers.
I have a listbox with 8 columns. Multiselect is enabled, and it must stay this way. As part of my program, after the user presses a command button, I need to use the row indexes of the selected rows in order to copy the selected information into an array which is then placed in a different listbox, and then delete the items from the original list. Pseudocode of what I want to do:
But my understanding is that .ListIndex does not work this way with multiselect listboxes. I've tried searching for a solution for a while, but I cannot find one.
I have the below to check for a numeric entry and when it's not, it deletes the entry, shows a Splash Form for a few seconds telling the user to enter Numeric, and then unloads.
The problem is, on the SetFocus part. I thought that it should put the cursor back into TextBox2 for another entry. It doesn't, in fact the cursor is nowhere to be seen. I have to grab the mouse and click in the TB2 to reenter a number.
Private Sub TextBox2_Change() '//Check for numeric entry If Not IsNumeric(TextBox2) Then Me.TextBox2 = "" '//Show SplashForm if not numeric SplashForm.Show Me.TextBox2.SetFocus End If
I have been working for 8-1/2 hours to get the focus to move to a specified control on my user form if criteria are met in two other controls on the same user form. It's not responding as I expect. I think I know what is happening; I just don't know why.
Situation: I have a user form with the following relevant fields in this tab order - LMonthDay, tbMonthDay, SBMonthDay, LYear, tbYear, SBYear, LTime, and tbTime. I used the designations L, tb, and SB in my control names to represent label, text box, and spin button respectively.
Problem: Once the SBMonthDay control has the focus, if I press TAB without changing the control's value, it does not execute the Exit event statement the way I anticipated. I want the focus to move to the tbTime control when the tbMonthDay & tbYear controls are already properly populated. (They will already be populated for 99% of the entries in this case.)
Private Sub SBMonthDay_Exit(ByVal Cancel As MSForms.ReturnBoolean) Debug.Print "SBMonthDay_Exit Begin" If ISLIKE(tbMonthDay.text, "####") _ And ISLIKE(tbYear.text, "####") Then tbTime.SetFocus Else: tbYear.SetFocus End If Debug.Print "SBMonthDay_Exit End" End Sub ...........................................
I have a userform with a multipage consisting of 4 tabs.
Each one has several combobox's and 1 commandbutton.
As you move through the form the commandbutton moves the data to my worksheet then moves you to the next page. When it reaches the last page it will return you to the first page then unload the form which is great.
The problem I am having is the cursor is not in any of the boxes on the first page. If I click on one of the other tabs then return to first page the first combobox has the focus. All the tab orders are correct. Can anyone point me in the right direction.
Private Sub cmdNext3_Click() ActiveWorkbook.Sheets("CarDetails").Activate Range("A1").Select Do If IsEmpty(ActiveCell) = False Then ActiveCell.Offset(1, 0).Select End If
I am using a Textbox1_Exit event that (if certain values are true) sets the focus to different Textbox. However, when I invoke the Textbox3.SetFocus, it redoes all the code in the Textbox1_Exit event since it's technically leaving now.
How do I stop this from happening and ensure that the Exit event happens once? OR How do I properly SetFocus inside an Exit event?