Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4236728
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:40:46+00:00 2026-05-21T02:40:46+00:00

Is it possible to import namespaces in VBA? I’m writing Word macros and I

  • 0

Is it possible to import namespaces in VBA? I’m writing Word macros and I want to put all functions inside Modules or Classes. But once I do that I see that I cannot reach the controls in the VBA form easily. I have to include the name of the form first, then access the control within that one. I can’t just go

TextBox1.Caption

I have to go

Form1.TextBox1.Caption

Is there a way to get around this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:40:46+00:00Added an answer on May 21, 2026 at 2:40 am

    You shouldn’t be coupling your classes/modules so tightly. A worker module shouldn’t require knowledge of the Form1 class, because then it can’t be used separately in another project.

    Instead, you probably want to pass the function in your helper class an argument on which it performs work, and then returns the result (if necessary). As a completely useless, trivial example:

    Public Sub SetLabelText(ByVal lbl As Label, ByVal caption As String)
        lbl.Caption = caption
    End Sub
    

    And you would call it from within the form class, like so:

    MyHelpers.SetLabelText(Label1, "New Label Caption")
    

    That way, you can use the functions in your helper class from any form.


    But, as far as your actual question, no. VBA doesn’t have any concept of “namespaces”. The best you can do is the With statement, but having to do this frequently is more likely an indication of a design flaw, as I discussed above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to import the attributes of one table, then I put it
Is it possible to import arbitrary modules in cython, compile them to shared object
Is it possible to declare 2 namespaces and group 2 diferent group of functions
Is it possible to import a namespace from an assembly that is not in
it is possible to import the css file from another server? let's say i
Is it possible to import a shared object (without linking the program with it)
Summary: Is it possible to: Import data into Hadoop with the «MongoDB Connector for
Is it possible to use @import in one css file like this. @import file1
How is it possible to run import win32api successfully on a 64bit maya version
Possible Duplicate: Best practice: Import mySQL file in PHP; split queries How to import

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.