Type of textbox on userform

  • Thread starter Lieven Mettepenningen
  • Start date
L

Lieven Mettepenningen

Hello,

could someone tell me what the type is of a textbox you put on a userform
with the vba toolbox? I want to create such a textbox at runtime via a class
module. I thought it was from type MSForms.TextBox, but this type hasn't got
the event handler LostFocus, which I really need for my application and
which all the regular textboxes on a userform do have. Could someone help me
please?

Thx,

Lieven
 
J

Jan Karel Pieterse

Hi,

It is indeed an msForms.Textbox.

But not all events you have in the userform's code module
itself are available in a class module.

Regards,

Jan Karel Pieterse
Excel TA/MVP
 
T

Tom Ogilvy

Just adding to Jan's good advice:

Lostfocus is not an event any textboxes have on a userform. It is an event
provided by the OLEObject on a worksheet and is only available to msforms
textboxes when they are placed on a worksheet. Events provided by the
containers OLEObject and Control, are not available in With Events/class
modules in my experience.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top