.XLA's Code Not Available?

P

PeteCresswell

I started this in another thread, but now it seems unrelated to that
thread.

I've got what seems tb a valid .XLA file (has the little red square in
the upper right hand corner of it's icon, was created by doing a "Save
As" and specifying .XLA).

When I open a workbook - let's call it "ABC.XLS" and then open
the .XLA; the code in the .XLA is visible via Project Manager.

When I open up a .XLA code module and then an Immediate window, I can
execute code in the .XLA.

But when I open up one of the .XLS's modules and then and Immediate
window Excel pops a "Compile error: Sub or Function not defined"
dialog.

I think the .XLA is valid bc with Tools | AddIns | Browse I can add it
to the list of ABC's Add-Ins.

But even with it added to the AddIn list (as opposed to just being
opened at the same time) that code is not available in an Immediate
window opened from one of ABC's modules.

Seems to me like I had something like this working some weeks back
with no problems.

Clearly I'm doing something dumb.

But what?
 
N

Norman Jones

Hi Pete,

When the XLA is the active project, you
can call its functions directly from the
Immediate window (BTW, there is only
one Intermediate window).

To call the addin when another project
is active - say your ABC workbook, you
would need to use the Application's Run
method.

Alternatively, if you set a reference in your
ABC workbook to the xla, the functions
and subs will be avqailable in to you as if
they were native to the ABC workbook.
 
P

PeteCresswell

Hi Pete,

there is only one Intermediate window).

That's how it seems - since prior commands that I've typed in to the
window persist whether I'm coming to the window from ABC.xls or
the .XLA.

But it acts differently depending on whether I invoke it from ABC.xls
or the .XLA.
Alternatively, if you set a reference in your
ABC workbook to the xla, the functions
and subs will be avqailable in to you as if
they were native to the ABC workbook.

I tried the Reference approach - and Excel allowed me to set the ref.
But it still doesn't recoginize the Sub when I go to the Immediate
window from ABC.XLS.

I'm 99% sure I wasn't having this problem several weeks ago when I
consolodated all my code into a .XLA (and then, foolishly, moved it
back to the .XLS...) - and I don't know enough to have been setting a
reference or anything at that time.... all I was doing was having
both .XLS and .XLA open at the same time.

So my money's still on Yours Truly doing something dumb.

But what?


Could the method of importing the code into the .XLA have anything to
do with it? When I exported, the qualifier defaulted to .CLS and I
changed it to .BAS.... and then imported the .BAS text files into
the .XLA.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top