Is it possible to import namespace in VBA? I am writing word macros and I want to put all the functions inside modules or classes. But once I do this, I see that I can not easily reach the controls in the VBA form. I must first include the name of the form, then we will have to use the control within that one. I just can not go
textbox1.caption I have to go
Form1.TextBox1.Capttion Is there any way around this?
You should not add your classes / modules so strictly. A worker module should not require the knowledge of the Form1 class, since then it can not be used separately in any other project. Instead, you probably want to return the function to logic in its helper class, and then return the result (if necessary). Completely useless, trivial example: public sub-setlabelite (labeled as VALABLE LBL, by-captions as string) lbl. Caption = caption closing sub
MyHelpers.SetLabelText (label 1, "new label caption") In this way, you can use the function from any form in your assistant category.
But, as far as your real question is, no. There is no concept of "namespace" in VBA. The best you can do is with statement, but often it has to be done, as I have discussed above, a sign of a design fault is greater. .
Comments
Post a Comment