Yes. You should be able to reference an object something like the following.
Code:
Frame1.txtFile.Value
Frame1.opt1.Value
You may need to provide a copy of the code to let us help you find the problem, if these kinds of statements aren't working.
You may also want to try refering to the object plainly by name. Sometimes the app will know what you are refering to and not need the reference to the frame object as well. i.e.
Code:
txtFile.Value
opt1.Value
Last edited by NatThoelecke; September 22nd, 2005 at 12:56 PM.
Reason: Thought of something else that might help
Death is life's special way of telling you you're fired.
For I do not seek to understand in order to believe, but I believe in order to understand. For I believe this: unless I believe, I will not understand. - Anselm of Canterbury (1033–1109)
The first statement works fine. The second does not even if the button is named MyCheckBox. Simply, VB does not recognize the name of the object when it is inside a frame.
To use CallByName I have to put an object inside it ...
Code:
CallByName(Frame1.Controls.Item(0), ...
' would work, but it doesn't solve my problem
Thanks anyway.
Did it help? rate it.
The best conversation I had was over forty million years ago ... and that was with a coffee machine.
So, even if you use MyCheckBox without accessing the frame, it still doesn't work? That is weird, and obviously related to VBA or excel somehow.
I'm not sure of understanding your sentence. What do you mean by "without accessing the frame"?
I'm not accessing anything.
Take a look at the code ... I just want to get the value of a property ...
Supose the checkbutton were placed outside the frame. I could do
Code:
MsgBox(MyCheckButton.Value)
In theory, with the button inside the frame it should be
Code:
MsgBox(Frame1.MyCheckButton.Value)
but it does not work, VB does not recognize the name of the object.
Originally Posted by WizBang
Suppose you place the control outside the frame at design time, and place it inside the frame at runtime, either via API or the Container property?
Well, I was trying to do something simpler than Frame1.Controls.Item(0).Value ... but moving the object at run time ... uffff
It's just a matter of coding simplicity and clarity.
Thanks
Did it help? rate it.
The best conversation I had was over forty million years ago ... and that was with a coffee machine.
I'm not sure of understanding your sentence. What do you mean by "without accessing the frame"?
I'm not accessing anything.
I mean, in vb you don't need to specify the frame to get at the controls in it. I've never done that, so I don't even know if it is supposed to work. So, try just MsgBox(MyCheckButton.Value). Nevermind that it is inside a frame. Does this work?
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
I mean, in vb you don't need to specify the frame to get at the controls in it. I've never done that, so I don't even know if it is supposed to work. So, try just MsgBox(MyCheckButton.Value). Nevermind that it is inside a frame. Does this work?
WizBang,
no, it does not work. And yes, you need to specify the frame. If you don't specify the frame, you are referencing objects outside the frame.
You can create two identical objects with the same name, one at the "Sheet" level and another one at the "Frame" level.
The first one's name will be, assuming it is on Sheet1, Sheet1.MyButton although you can use MyButton without qualifying it, provided the scope of the statement is adequate.
The second one's name should be Sheet1.Frame1.MyButton Again, with an appropiate scope you can use Frame1.MyButton or MyButton
The problem is ... this is in theory, because I cannot use objects inside frames using its name, I'm only able to use Frame1.Objects.Item(n)
Are you using objects inside frames? Could you post an example? In wich version of Excell/VB (I'm using Excell 2002/VB6.3) ?
Thanks a lot
Last edited by DeepButi; September 26th, 2005 at 09:27 AM.
Did it help? rate it.
The best conversation I had was over forty million years ago ... and that was with a coffee machine.
In VB (not excel), there is no need to specify the frame because all the controls are seen at form level. I've never used excel, so I don't know what differences you might encounter. Suppose you create a UserControl, and expose the controls that way? Then you can create whatever methods and means of access you need.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
WizBang,
yes, you're right, I work usually with VB.NET and never found such a problem, but now I'm working on that particular combination of Excell2002/VB6.3 and I'm really surprised of not "seeing" the objects anywhere. Not at the Sheet (form) level, neither at the frame level.
I'm forced to use frames because I use several sets of radio-buttons. If I put all of them at the Sheet level, they group together and only one can be selected, so I need to put each set in a separate frame.
Anyone using controls inside frames on Excell2002/VB6.3 out there?
Thanks for all your answers.
Did it help? rate it.
The best conversation I had was over forty million years ago ... and that was with a coffee machine.
I seem to recall the forms 2.0 option buttons having a property that allowed them to be grouped without using a frame. They might come with excel, but I'm not sure. However, the forms 2.0 controls are so buggy, they are usually not worth using. Also they aren't redistributable.
I still think a UserControl would be the way I'd do this.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.