Crazy Multipages!

chedarmaster

New Member
Joined
Aug 29, 2011
Messages
7
Greetings, masters.

I bring you:

1 form - named frmLavandaria
2 multipages - First Named multipageEmpregados
Second Named MultiPage1


In the code I try to add a new page to the first but it's impossible, it allways says it cannot find the "Specified Object". I'm using the:

"set NewPage = frmLavandaria!multipageEmpregados!Pages!Add"

And I have tried also the "frmLavandaria!multipageEmpregados!Pages!Add".


HOWEVER, if I just do:

"frmLavandaria.MultiPage1.Pages.Add"

it adds a new page to the MultiPage1 control even in Runtime without any problem!

Can I not rename a MultiPage? Is that what renders it useless in the code?



Sub cmdButtoncontratarempregado_Click()


Dim i As Integer
'Dim NewPage As Msforms.Page
Dim LavandariaEmpregadoPage As Msforms.Page

i = 0
For Each LavandariaEmpregadoPage In frmLavandaria.MultiPage1.Pages
i = i + 1
Next LavandariaEmpregadoPage

frmLavandaria.MultiPage1.Pages.Add

'Set NewPage = frmLavandaria!multipageEmpregados!Pages!Add
(Please mind that when I remove the " ' " I also rewrite the
whole code to use multipageEmpregados instead of MultiPage1)

frmLavandaria.Repaint

frmLavandaria.MultiPage1.Pages(i).Caption = "Emp" & CStr(i + 1)


End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Please IGNORE my previous thread. After DAYS working on this I decided to try and delete the multipages and redo all. And guess what? Now it's working fine with a renamed multipage...
 
Upvote 0

Forum statistics

Threads
1,224,519
Messages
6,179,263
Members
452,902
Latest member
Knuddeluff

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