Calling macro from another loaded macro

Calling macro from another loaded macro

Anonymous
Not applicable
366 Views
7 Replies
Message 1 of 8

Calling macro from another loaded macro

Anonymous
Not applicable
Hi,

Is it possible to call a macro from another loaded DVB file's modules.

When I call one it says that it is not defined.

If yes how?


Thanks.
0 Likes
367 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
If you reference the other dvb, it will always be loaded if it isn't
already. Then refer to the macro with the full qualification to the macro:
dvbProjectName.ModuleName.MacroOrFunctionName.

--
--
Ed
--
"Yves" wrote in message
news:1DF2E08718E17EBC5E063ED0BECCA41A@in.WebX.maYIadrTaRb...
> Hi,
>
> Is it possible to call a macro from another loaded DVB file's modules.
>
> When I call one it says that it is not defined.
>
> If yes how?
>
>
> Thanks.
>
>
0 Likes
Message 3 of 8

Anonymous
Not applicable
Thanks Ed,

But the macro I'm trying to run is loaded, well, I see it in me VBA Editor,
and when I type in a new sub the name of the current project, when I type
the ".", all the available Subs, Modules, forms, appear in a dropdown list,

But when I type the name of the other project, nothing appends, and I get
Variable not defined.

To my surprise all the project I created so far, had the name ACADProject, I
renamed them, is it OK?

Thanks.

"Ed Jobe" a écrit dans le message de
news:646DFBD18F5649D70DAE75DDA633B2A2@in.WebX.maYIadrTaRb...
> If you reference the other dvb, it will always be loaded if it isn't
> already. Then refer to the macro with the full qualification to the macro:
> dvbProjectName.ModuleName.MacroOrFunctionName.
>
> --
> --
> Ed
> --
> "Yves" wrote in message
> news:1DF2E08718E17EBC5E063ED0BECCA41A@in.WebX.maYIadrTaRb...
> > Hi,
> >
> > Is it possible to call a macro from another loaded DVB file's modules.
> >
> > When I call one it says that it is not defined.
> >
> > If yes how?
> >
> >
> > Thanks.
> >
> >
>
>
0 Likes
Message 4 of 8

Anonymous
Not applicable
Naturally, unique names will help. The behavior you describe is called
Intellisense. It only happens for early binding, not late binding. To
acheive early binding, reference the other project (Tools>References), even
though it is loaded.

--
--
Ed
--
"Yves" wrote in message
news:7119403B5736B0422E1EB016E8E06209@in.WebX.maYIadrTaRb...
> Thanks Ed,
>
> But the macro I'm trying to run is loaded, well, I see it in me VBA
Editor,
> and when I type in a new sub the name of the current project, when I type
> the ".", all the available Subs, Modules, forms, appear in a dropdown
list,
>
> But when I type the name of the other project, nothing appends, and I get
> Variable not defined.
>
> To my surprise all the project I created so far, had the name ACADProject,
I
> renamed them, is it OK?
>
> Thanks.
>
> "Ed Jobe" a écrit dans le message de
> news:646DFBD18F5649D70DAE75DDA633B2A2@in.WebX.maYIadrTaRb...
> > If you reference the other dvb, it will always be loaded if it isn't
> > already. Then refer to the macro with the full qualification to the
macro:
> > dvbProjectName.ModuleName.MacroOrFunctionName.
> >
> > --
> > --
> > Ed
> > --
> > "Yves" wrote in message
> > news:1DF2E08718E17EBC5E063ED0BECCA41A@in.WebX.maYIadrTaRb...
> > > Hi,
> > >
> > > Is it possible to call a macro from another loaded DVB file's modules.
> > >
> > > When I call one it says that it is not defined.
> > >
> > > If yes how?
> > >
> > >
> > > Thanks.
> > >
> > >
> >
> >
>
>
0 Likes
Message 5 of 8

Anonymous
Not applicable
Thanks,

After a couple of try and error I found that in the reference tables, there
was my MacroCAD!!!

But for Late binding... what's the name of a DVB file for me to bind at
execution?

"Ed Jobe" a écrit dans le message de
news:16C571F144296327D6CABADCAF82E3E8@in.WebX.maYIadrTaRb...
> Naturally, unique names will help. The behavior you describe is called
> Intellisense. It only happens for early binding, not late binding. To
> acheive early binding, reference the other project (Tools>References),
even
> though it is loaded.
>
> --
> --
> Ed
> --
> "Yves" wrote in message
> news:7119403B5736B0422E1EB016E8E06209@in.WebX.maYIadrTaRb...
> > Thanks Ed,
> >
> > But the macro I'm trying to run is loaded, well, I see it in me VBA
> Editor,
> > and when I type in a new sub the name of the current project, when I
type
> > the ".", all the available Subs, Modules, forms, appear in a dropdown
> list,
> >
> > But when I type the name of the other project, nothing appends, and I
get
> > Variable not defined.
> >
> > To my surprise all the project I created so far, had the name
ACADProject,
> I
> > renamed them, is it OK?
> >
> > Thanks.
> >
> > "Ed Jobe" a écrit dans le message de
> > news:646DFBD18F5649D70DAE75DDA633B2A2@in.WebX.maYIadrTaRb...
> > > If you reference the other dvb, it will always be loaded if it isn't
> > > already. Then refer to the macro with the full qualification to the
> macro:
> > > dvbProjectName.ModuleName.MacroOrFunctionName.
> > >
> > > --
> > > --
> > > Ed
> > > --
> > > "Yves" wrote in message
> > > news:1DF2E08718E17EBC5E063ED0BECCA41A@in.WebX.maYIadrTaRb...
> > > > Hi,
> > > >
> > > > Is it possible to call a macro from another loaded DVB file's
modules.
> > > >
> > > > When I call one it says that it is not defined.
> > > >
> > > > If yes how?
> > > >
> > > >
> > > > Thanks.
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 6 of 8

Anonymous
Not applicable
Binding is not something that you do, at least directly. That's a subject
better handled by you doing a little research on to get the handle of it.
Here is something from Help:
Object Data Type
Object variables are stored as 32-bit (4-byte) addresses that refer to
objects. Using the Set statement, a variable declared as an Object can have
any object reference assigned to it.

Note Although a variable declared with Object type is flexible enough to
contain a reference to any object, binding to the object referenced by that
variable is always late (run-time binding). To force early binding
(compile-time binding), assign the object reference to a variable declared
with a specific class name.

If you need more info, check out MSDN.

--
--
Ed
--
"Yves" wrote in message
news:87A361F6604DF9CDA4C3F01B1B0529CB@in.WebX.maYIadrTaRb...
> Thanks,
>
> After a couple of try and error I found that in the reference tables,
there
> was my MacroCAD!!!
>
> But for Late binding... what's the name of a DVB file for me to bind at
> execution?
>
> "Ed Jobe" a écrit dans le message de
> news:16C571F144296327D6CABADCAF82E3E8@in.WebX.maYIadrTaRb...
> > Naturally, unique names will help. The behavior you describe is called
> > Intellisense. It only happens for early binding, not late binding. To
> > acheive early binding, reference the other project (Tools>References),
> even
> > though it is loaded.
> >
> > --
> > --
> > Ed
> > --
> > "Yves" wrote in message
> > news:7119403B5736B0422E1EB016E8E06209@in.WebX.maYIadrTaRb...
> > > Thanks Ed,
> > >
> > > But the macro I'm trying to run is loaded, well, I see it in me VBA
> > Editor,
> > > and when I type in a new sub the name of the current project, when I
> type
> > > the ".", all the available Subs, Modules, forms, appear in a dropdown
> > list,
> > >
> > > But when I type the name of the other project, nothing appends, and I
> get
> > > Variable not defined.
> > >
> > > To my surprise all the project I created so far, had the name
> ACADProject,
> > I
> > > renamed them, is it OK?
> > >
> > > Thanks.
> > >
> > > "Ed Jobe" a écrit dans le message de
> > > news:646DFBD18F5649D70DAE75DDA633B2A2@in.WebX.maYIadrTaRb...
> > > > If you reference the other dvb, it will always be loaded if it isn't
> > > > already. Then refer to the macro with the full qualification to the
> > macro:
> > > > dvbProjectName.ModuleName.MacroOrFunctionName.
> > > >
> > > > --
> > > > --
> > > > Ed
> > > > --
> > > > "Yves" wrote in message
> > > > news:1DF2E08718E17EBC5E063ED0BECCA41A@in.WebX.maYIadrTaRb...
> > > > > Hi,
> > > > >
> > > > > Is it possible to call a macro from another loaded DVB file's
> modules.
> > > > >
> > > > > When I call one it says that it is not defined.
> > > > >
> > > > > If yes how?
> > > > >
> > > > >
> > > > > Thanks.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 7 of 8

Anonymous
Not applicable
Thanks, but that was my question, maybe badly asked I confess, I wanted to
know how to declare a variable to get that early binding.

I expexted to do:
Dim var as MacroCad
Set car as new MacrocaD
That would be early binding.

I get an error (Expected user defined, not project)

If I put a reference to the project (MacroCad),

Then the following works.
MacroCad.Subs.seekLayer("TOPOLOGY", Doc), but only if it is referenced, so
is it the only way to access this project, having it referenced on all the
projects I build.

Thanks again.




And it is working.


"Ed Jobe" a écrit dans le message de
news:E57016511E62D3B267492BD289F583B9@in.WebX.maYIadrTaRb...
> Binding is not something that you do, at least directly. That's a subject
> better handled by you doing a little research on to get the handle of it.
> Here is something from Help:
> Object Data Type
> Object variables are stored as 32-bit (4-byte) addresses that refer to
> objects. Using the Set statement, a variable declared as an Object can
have
> any object reference assigned to it.
>
> Note Although a variable declared with Object type is flexible enough to
> contain a reference to any object, binding to the object referenced by
that
> variable is always late (run-time binding). To force early binding
> (compile-time binding), assign the object reference to a variable declared
> with a specific class name.
>
> If you need more info, check out MSDN.
>
> --
> --
> Ed
> --
> "Yves" wrote in message
> news:87A361F6604DF9CDA4C3F01B1B0529CB@in.WebX.maYIadrTaRb...
> > Thanks,
> >
> > After a couple of try and error I found that in the reference tables,
> there
> > was my MacroCAD!!!
> >
> > But for Late binding... what's the name of a DVB file for me to bind at
> > execution?
> >
> > "Ed Jobe" a écrit dans le message de
> > news:16C571F144296327D6CABADCAF82E3E8@in.WebX.maYIadrTaRb...
> > > Naturally, unique names will help. The behavior you describe is called
> > > Intellisense. It only happens for early binding, not late binding. To
> > > acheive early binding, reference the other project (Tools>References),
> > even
> > > though it is loaded.
> > >
> > > --
> > > --
> > > Ed
> > > --
> > > "Yves" wrote in message
> > > news:7119403B5736B0422E1EB016E8E06209@in.WebX.maYIadrTaRb...
> > > > Thanks Ed,
> > > >
> > > > But the macro I'm trying to run is loaded, well, I see it in me VBA
> > > Editor,
> > > > and when I type in a new sub the name of the current project, when I
> > type
> > > > the ".", all the available Subs, Modules, forms, appear in a
dropdown
> > > list,
> > > >
> > > > But when I type the name of the other project, nothing appends, and
I
> > get
> > > > Variable not defined.
> > > >
> > > > To my surprise all the project I created so far, had the name
> > ACADProject,
> > > I
> > > > renamed them, is it OK?
> > > >
> > > > Thanks.
> > > >
> > > > "Ed Jobe" a écrit dans le message de
> > > > news:646DFBD18F5649D70DAE75DDA633B2A2@in.WebX.maYIadrTaRb...
> > > > > If you reference the other dvb, it will always be loaded if it
isn't
> > > > > already. Then refer to the macro with the full qualification to
the
> > > macro:
> > > > > dvbProjectName.ModuleName.MacroOrFunctionName.
> > > > >
> > > > > --
> > > > > --
> > > > > Ed
> > > > > --
> > > > > "Yves" wrote in message
> > > > > news:1DF2E08718E17EBC5E063ED0BECCA41A@in.WebX.maYIadrTaRb...
> > > > > > Hi,
> > > > > >
> > > > > > Is it possible to call a macro from another loaded DVB file's
> > modules.
> > > > > >
> > > > > > When I call one it says that it is not defined.
> > > > > >
> > > > > > If yes how?
> > > > > >
> > > > > >
> > > > > > Thanks.
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes
Message 8 of 8

Anonymous
Not applicable
Binding takes place when the dvb loads. It refers to how each object knows
what its supposed to do. When the vba environment initializes, it has to
load or bind the code to each object. If that code comes from a source
external to where the object is declared, it can be bound at load time or at
runtime. The modules you referenced are bound at loadtime. You don't need to
dim a var, just use the module. If you create a new object, as from a class
object in the referenced dvb, then you need to dim an object variable as
noted in the help topic I sent.

--
--
Ed
--
"Yves" wrote in message
news:F8241DCEA83F6C64EE86ADC04B579CA2@in.WebX.maYIadrTaRb...
> Thanks, but that was my question, maybe badly asked I confess, I wanted to
> know how to declare a variable to get that early binding.
>
> I expexted to do:
> Dim var as MacroCad
> Set car as new MacrocaD
> That would be early binding.
>
> I get an error (Expected user defined, not project)
>
> If I put a reference to the project (MacroCad),
>
> Then the following works.
> MacroCad.Subs.seekLayer("TOPOLOGY", Doc), but only if it is referenced, so
> is it the only way to access this project, having it referenced on all the
> projects I build.
>
> Thanks again.
>
>
>
>
> And it is working.
>
>
> "Ed Jobe" a écrit dans le message de
> news:E57016511E62D3B267492BD289F583B9@in.WebX.maYIadrTaRb...
> > Binding is not something that you do, at least directly. That's a
subject
> > better handled by you doing a little research on to get the handle of
it.
> > Here is something from Help:
> > Object Data Type
> > Object variables are stored as 32-bit (4-byte) addresses that refer to
> > objects. Using the Set statement, a variable declared as an Object can
> have
> > any object reference assigned to it.
> >
> > Note Although a variable declared with Object type is flexible enough
to
> > contain a reference to any object, binding to the object referenced by
> that
> > variable is always late (run-time binding). To force early binding
> > (compile-time binding), assign the object reference to a variable
declared
> > with a specific class name.
> >
> > If you need more info, check out MSDN.
> >
> > --
> > --
> > Ed
> > --
> > "Yves" wrote in message
> > news:87A361F6604DF9CDA4C3F01B1B0529CB@in.WebX.maYIadrTaRb...
> > > Thanks,
> > >
> > > After a couple of try and error I found that in the reference tables,
> > there
> > > was my MacroCAD!!!
> > >
> > > But for Late binding... what's the name of a DVB file for me to bind
at
> > > execution?
> > >
> > > "Ed Jobe" a écrit dans le message de
> > > news:16C571F144296327D6CABADCAF82E3E8@in.WebX.maYIadrTaRb...
> > > > Naturally, unique names will help. The behavior you describe is
called
> > > > Intellisense. It only happens for early binding, not late binding.
To
> > > > acheive early binding, reference the other project
(Tools>References),
> > > even
> > > > though it is loaded.
> > > >
> > > > --
> > > > --
> > > > Ed
> > > > --
> > > > "Yves" wrote in message
> > > > news:7119403B5736B0422E1EB016E8E06209@in.WebX.maYIadrTaRb...
> > > > > Thanks Ed,
> > > > >
> > > > > But the macro I'm trying to run is loaded, well, I see it in me
VBA
> > > > Editor,
> > > > > and when I type in a new sub the name of the current project, when
I
> > > type
> > > > > the ".", all the available Subs, Modules, forms, appear in a
> dropdown
> > > > list,
> > > > >
> > > > > But when I type the name of the other project, nothing appends,
and
> I
> > > get
> > > > > Variable not defined.
> > > > >
> > > > > To my surprise all the project I created so far, had the name
> > > ACADProject,
> > > > I
> > > > > renamed them, is it OK?
> > > > >
> > > > > Thanks.
> > > > >
> > > > > "Ed Jobe" a écrit dans le message de
> > > > > news:646DFBD18F5649D70DAE75DDA633B2A2@in.WebX.maYIadrTaRb...
> > > > > > If you reference the other dvb, it will always be loaded if it
> isn't
> > > > > > already. Then refer to the macro with the full qualification to
> the
> > > > macro:
> > > > > > dvbProjectName.ModuleName.MacroOrFunctionName.
> > > > > >
> > > > > > --
> > > > > > --
> > > > > > Ed
> > > > > > --
> > > > > > "Yves" wrote in message
> > > > > > news:1DF2E08718E17EBC5E063ED0BECCA41A@in.WebX.maYIadrTaRb...
> > > > > > > Hi,
> > > > > > >
> > > > > > > Is it possible to call a macro from another loaded DVB file's
> > > modules.
> > > > > > >
> > > > > > > When I call one it says that it is not defined.
> > > > > > >
> > > > > > > If yes how?
> > > > > > >
> > > > > > >
> > > > > > > Thanks.
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
0 Likes