JimminyJim
New Member
- Joined
- Mar 13, 2025
- Messages
- 7
- Office Version
- 365
- Platform
- Windows
As per the heading: I'm trying to access variables, macros, functions in another module
I know that I can use (if calling from Module 1):
Module2.variable
Module2.sub
Module2.function
(assuming declared as public)
But how can i use 'With' statement to access multiple?
I've tried:
I get "Object doesn't support this property or method" on each line item after 'With myMod'. Yes I have the extensibility library loaded.
This example might seem trivial, but in my actual project I wish to access many different variables and functions in many different modules to do bulk data retrieval and writing.
Is there something I can use to identify a module that can be used in a WITH statement?
I know that I can use (if calling from Module 1):
Module2.variable
Module2.sub
Module2.function
(assuming declared as public)
But how can i use 'With' statement to access multiple?
I've tried:
Code:
Dim myMod As VBIDE.VBComponent
Set myMod = ThisWorkbook.VBProject.VBComponents("Module2")
With myMod
.variable = 15
.sub
.function
End With
I get "Object doesn't support this property or method" on each line item after 'With myMod'. Yes I have the extensibility library loaded.
This example might seem trivial, but in my actual project I wish to access many different variables and functions in many different modules to do bulk data retrieval and writing.
Is there something I can use to identify a module that can be used in a WITH statement?