Multipage form set focus

wpryan

Well-known Member
Joined
May 26, 2009
Messages
534
Office Version
  1. 365
Platform
  1. Windows
Hi All, I have a multipage form in my workbook that, on the Activate event, opens to the first page with:

Code:
userform1.multipage1.value=0

This is working fine. However, on the second page I have a date field that, when entered, opens up a simple date form, with an OK and Cancel button. If either of these are pressed, I want the form to close and the focus to remain on the second page. I've tried various iterations of this code, but none of them work. The focus always goes back to the first page.
Code:
Private Sub cmdCancel_Click()
    UserForm1.txtDate = ""
    frmTxDate.Hide
    UserForm1.txtSW.SetFocus ' this text box is in the second page of the multiform.
    UserForm1.Multipage1.Value = 1
End Sub
...any ideas?
 
Why do you need the activate code to set the multi page to 0, when it seems that's not what you want to happen here?
 
Upvote 0
Hello, I want the form, when it initially opens, to go to index 0. Page 2 (multipage index 1) contains a date field, which on enter, opens a calendar type form. On closing the calendar form, I want the focus to remain on multipage index 1.
 
Upvote 0
By default it should load on the first page.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top