[E2007] My VBA turned into an AddIn doesn't see objects

S

Steve JORDI

Hi,
Just beginning programming Excel 2007 with VBA.

My application works perfectly as long as it's embedded in my excel
file. This one has "Microsoft Excel Objects" where you can see all the
sheet pages and a "Modules" section where I have my VBA code.

Now I wanted to be able to use my code on each of my Excel files.
So I followed instructions to turn this into an AddIn and install it
in Excel 2007 but the problem is that when launched, the code stops
immediately telling me
Runtime error 424
Object required

Now, it's probably due to the fact that it doesn't see the actual file
objects. I have the feeling it's limited to its own environment, own
space.

To create the Add In, I opened a new empty Excel file, added a Module,
then added my VBA code.
Named the project name: ReadTime.
Saved as an AddIn.
Installed the AddIn in Excel 2007

Of course, when I open a new Excel file and go to the VBA editor, I
can see my worksheet objects, sheets 1 to 8.
Then I see another Project, which has a Module1 with my code, what I
expected to have.

If I step into the code, any reference to the main Excel file objects
leads to an error.
The code executes correctly but doesn't see the objects (sheets 1 to
8). Of course those sheets 1 to 8 objects are not in my "ReadTime"
project, only in the excel workbook itself.

It's surely nothing complex, but I'm missing something to make my
AddIn work in any Excel file.

Thanks for any help on this.

Sincerely,
Steve JORDI

(Remove the K_I_L_LSPAM from my email address)
 
M

Mike H

Hi,

I think you will need to post your code to get help on this but it could be
as simple as the way you are referring to objects

For example instead of
Sheets("Sheet8").Range...
use
activeworkbook.Sheets("Sheet8").Range..

Mike
 
S

Steve JORDI

Mike,
thanks for your prompt reply...

Just added the recommandation and it seems to work :)

Ok good, I'll continue going ahead now.

I love forums! What a resource for developers!

Again, thanks a lot.





Sincerely,
Steve JORDI

(Remove the K_I_L_LSPAM from my email address)
 

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