Hello,
I am getting a type mismatch "Run-time error '13'" when I try to assign a textbox to a property of a class object which is defined as textbox. I do the same thing for combobox and button controls with no problem.
The class "clsSessionTextBox" is like:
------------------------
Public strMillName As String
Public strControlName As String
Public ctlTextBox As TextBox
------------------------
The following is extracted from the function where I am getting the error:
Dim clsTxt As clsSessionTextBox
Set clsTxt = New clsSessionTextBox
Set clsTxt.ctlTextBox = txtSessionIDArc <--- this throws the error
-------------------------
txtSessionIDArc exists and is a valid textbox.
[txtSessionIDArc TextBox (properties definition)]
As I mentioned earlier, I do the same type of things for comboboxes and commandbuttons and they process just fine. The class seems defined correctly to me. I have thrown another textbox on the sheet and plugged it into the code just to see if there was something odd about the other textbox control but the result is the same.
I have tried as many variations as I can think of and searched for posts with similar problems but I cannot find a solution.
Oh, this is an Excel 2003 workbook that is now being modified in Excel 2007. It was working fine until I entered the code to assign the textbox.
I am trying to build a collection of classes. I usually play in .Net land so Excel VBA is foreign enough to me to make me scratch my head now and again.
Thanks much,
Kim
I am getting a type mismatch "Run-time error '13'" when I try to assign a textbox to a property of a class object which is defined as textbox. I do the same thing for combobox and button controls with no problem.
The class "clsSessionTextBox" is like:
------------------------
Public strMillName As String
Public strControlName As String
Public ctlTextBox As TextBox
------------------------
The following is extracted from the function where I am getting the error:
Dim clsTxt As clsSessionTextBox
Set clsTxt = New clsSessionTextBox
Set clsTxt.ctlTextBox = txtSessionIDArc <--- this throws the error
-------------------------
txtSessionIDArc exists and is a valid textbox.
[txtSessionIDArc TextBox (properties definition)]
As I mentioned earlier, I do the same type of things for comboboxes and commandbuttons and they process just fine. The class seems defined correctly to me. I have thrown another textbox on the sheet and plugged it into the code just to see if there was something odd about the other textbox control but the result is the same.
I have tried as many variations as I can think of and searched for posts with similar problems but I cannot find a solution.
Oh, this is an Excel 2003 workbook that is now being modified in Excel 2007. It was working fine until I entered the code to assign the textbox.
I am trying to build a collection of classes. I usually play in .Net land so Excel VBA is foreign enough to me to make me scratch my head now and again.
Thanks much,
Kim