......”........... Continued from last post..............”......
¬_2c) Why can this catch one out, (why am I posting this “warning” )
I expect many people will just take the UserForm they see as a “thing” and use it by its name, whether the default, such as UserForm1 , ( UserForm2 if they create a second User Form “thing” ) or the name they give it.
I tried to access properties through the name of the “thing” I see in the VB Editor, which was actually the Class name, as it is always is.
My Code kindly given to me by someone was more “correctly” ( IMO ) written so as not to rely on Implicit defaults, so I had something like this
10 Dim fm1 As UserForm1
20 Set fm1 = New UserForm1
Subsequently code line such as
Let UserForm1.CheckBox1.Value = True
or in particular what was causing me problems
If UserForm1.CheckBox1.Value = True Then
Did not error as the first one of those used had creating a second new instance of Class UserForm1. But I was wanting to reference the first instance, fm1, as this was used further in the code for all dealings with the actual instance of the UserForm that I was interested in.
Hope that helps anyone else Puzzled that any code line similar to this is not giving the correct results
UserForm1.Property
or
myUserFormName.Property =
_................................................. ..............
_3) The solution / answer again to the main Question
_3a) Question.
UserForm.____ not working
_3b) Answer
If you have not yourself written the existing code, then check if your instancing of the actual userForm you are interested in has been done Explicitly, rather than left to the Implicit Default, which you are ( maybe unknowingly ) assuming
Alan
Edit P.s. Tell someone you are giving such a code : “I declared Explicitly the Userform, so bear that in mind if you attempt to access any of its Properties in code modifications – I did not leave it to the Implicit default of the UserForm Class name”. ( Not that would of made any difference to me – I would of just thought – “what load of old B llox is he making up now” .. Lol..)
Rem Ref
http://www.excelforum.com/showthread...t=#post4383895
Rem Ref http://www.excelforum.com/showthread...t=#post4381274
Rem Ref http://www.excelforum.com/showthread...t=#post4381275
Rem Ref http://www.excelforum.com/showthread...t=#post4381420




)
Reply With Quote
Bookmarks