You said:
"Problem: If I run it from the program window of the second form it
works fine,..."
[Because form1 is in "design mode" (not loaded); it is not in run mode.]
"but if I close the program and reopen it so that the first
form loads when I get to the second form and press okay so that it will
run the above code it gives me an error."
[Because then the form is in run mode, not design mode. You cannot "design'
a form that is running.]
I can reproduce the error thus:
Sub main() 'in standard module
UserForm2.Show vbModeless
Load UserForm1
End Sub
Private Sub UserForm_Click() 'in UserForm2
Dim VBC As Object
Set VBC = Workbooks("Book1.xls").VBProject.VBComponents("Use rForm1")
If VBC.Designer.Controls("ckwater").Caption = "hi" Then
VBC.Designer.Controls("ckwater").Caption = "lo"
Else
VBC.Designer.Controls("ckwater").Caption = "hi"
End If
End Sub
Regards,
Bob Kilmer
"lostthought " wrote in message
...
yeah Designer allows you to Change the UserForm using code. Anybody have
any idea why this isn't initializing?
---
Message posted from http://www.ExcelForum.com/