blackmail
blackmail

Reputation: 55

Getting the activecontrol name and value from a multipages form

I've been searching the web for a solution for a couple of months without any success. I created in Excel 2010 a UserForm with multipages. I'm trying to write a function that will get the activecontrol name and value.

Until now, I succeeded in getting the name of the control using this command Me.MultiPage1.Pages(Me.MultiPage1.Value).ActiveControl.Name but the only thing I managed to do with it was to set it in to a variable as a string. I still need to get it's value.

I really appreciate any help. blackmail

Upvotes: 3

Views: 6258

Answers (1)

Peter Albert
Peter Albert

Reputation: 17495

You can access the value of the last active control in the MultiPage control with this code:

Me.MultiPage1(Me.MultiPage1.Value).ActiveControl.Value

However, I'm not sure that every kind of control has a .Value property, so make sure that all your different controls in the Multipage has one - or include a proper error handler!

Upvotes: 3

Related Questions