views:

69

answers:

1

The following VBA 6 in Excel 2000 code
Resides in a form that has text boxes, comboboxes and buttons One of them is txtUsername, another is txtPassword --I inherited this code

With shtName
.Unprotect "thepassword"
.range("somenamedrange").Value = cboComboBox.Value
.txtUsername.Text = txtUsername.Text
.txtPassword.Text = txtPassword.Text
...
End With  

The code sets a text value for two worksheet objects that appear in the VBA Editor Object list, but are neither defined nor set anywhere else in the Excel Project. Option Explicit is used on all Microsoft Excel Objects, Forms and Modules. I can create procedures for said worksheet objects on said worksheet in the VBA Editor (e.g.,

Private Sub txtUsername_Change()  

End Sub

Neither object

worksheet.txtUsername

worksheet.txtPassword

appears nor is set as a named range.
The value of both objects is only used elsewhere by specific reference worksheet.txtUsername.Text
These values do not show up in the locals window after they are set on the worksheet. They are definitely used, as the Essbase queries complete successfully using these objects.

summary: i understand formName.txtUsername.Text (or .Value)
i do not understand a worksheet object that does not get defined nor instantiated via code
the only bright idea I had was to export the worksheet and view in a text editor, to see if my ancestors created a "custom" worksheet object the way one defines a "default property" in a class module--manually via text editor (no mention of either property in the worksheet.cls)

Thank you.

A: 

Worksheets that are part of the Excel spreadsheet do not have to instantiated, they're part of the workbook and just "always there". If they're not visible to the user but are visible in the project browser, there could be some code in the "ThisWorkbook" section that make the sheets invisible (.visible = false) when the workbook launches.

Michael
yes, the "Visible Property" or a "Type Property" or an "Activate Method" are built into the Excel worksheet class. For this worksheet only, along with Me.Activate, Me.Type, ... Me.txtUsername, Me.txtPassword are options, but there is no code, no macro, no add-in that I can find that injects these as part of the Excel Worksheet Object
nineowls
to be specific: The Excel Object Browser shows VBAProject contains class sheetName with Members txtUsername and txtPassword yet there is no definition of how these two members are injected!!
nineowls
after unprotect and unhide all rows and all colsF5 > Special >Objects"no objects found"or right click on txtUsername member in Object Browser "contains references to object definitions that cannot be found"
nineowls