Activate page in MultiPage control

This tip shows you have to activate a page of a Multipage control that is placed on a UserForm by using VBA code. Suppose that you have a UserForm (UserForm1) and there is a MultiPage control (Multipage1) on it. Now, you want to activate a page on the UserForm By executing VBA code. To do this task, you will follow the steps below:

-Create a module and define a variable in the module. This variable holds the index of a page on the UserForm. It starts from 0 (first page).   Dim pIndex As Integer

-In the Initialize procedure the UserForm, write the following code:  
MultiPage1.Value = pIndex

It will be look like this: Private Sub UserForm_Initialize()  
  MultiPage1.Value = pIndex
End Sub

-Write VBA code show the UserForm and activate a page.  
pIndex = 0
UserForm1.Show

Posted by: Lavy | post date: 12-24-2013 | Subject: MS Excel




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.