VBA Userform.Show Subscript out of range

Joined
Jan 25, 2011
Messages
3
Reaction score
0
As an old time procedural language programmer, I am struggling with VBA and OOP.

I am writting a VBA App for a local small business. The macro code is in 1 workbook (H2Oasis01) the data is in another (H2ONameDB).

In H2Oasis01, WorkBook_Activate
frmH2OMain.Show
cmdMemberMaint_click
- Open H2ONameDB, Build and sort an alternate index into H2ONameDB based on Last 4 digits of Phone Number (Seems to work, index built into an array defined as a Global.
- (Re)activate H2Oasis01
frmMaintMain.Show
Goes down with Subscript out of range
Other forms in the same project will "show"
frmMaintMain has been renamed, same issue

I understand that the subscript out of range "probably" means that VBA cannot find the Userform, and I understand that logic (semantics are weak, but logic is OK)...I have looked, re-looked, and looked again. I want to think it has something to do with two workbooks open and it cannot find the userform in H2ONameDB (which is correct, it is not there) but that begs the question, Why will other forms in the same project "show" and this one will not? @#*! trees are hiding the forest!
 
Went a little further, created a new userform (frmDummy), guess what, frmDummy.Show works....h-m-m-m
 
Stranger and Stranger...it now appears the DeBug(er) isn't working correctly. In the Sub Userform_Activate There was Code to Activate the Macro Worksbook (H2Oasis01) and The Worksheet(SystemVars) within it that contains global variables that need to survive a close/shutdown, I removed that code and ta-ta- it works. So it appears that the real thing VBA could not find was either in'Workbook("H2Oasis01").activate or WorkSheets("SystemVars").Activate
 
Back
Top