PDA

View Full Version : Need Help Attaching VBAProject Reference



Ken1000
04-25-2006, 04:37 AM
Hi. I am using Office 2003.

I made an excel file which includes the reference
Office Word 11.0 Object library within it. All macros
in this excel file work fine. I saved this file to be
backwards compatible (to be able to work with
earlier Excel versions).

I emailed this same file to a friend, who has Excel
2003. When he runs the same macros within it, he
gets an error message that this reference (the Office
Word 11.0 Object library) is not found. Thus, the
dependent code does not work on his end.

I thought that when I saved my excel file to include this
reference and gave him a copy, that any user with the
same copy should be able to access/use the same
specified library item(s) automatically.

If I am wrong in this, could you please tell me if there
is any VBA code that could automatically check to see
if the needed library reference was "attached" (included)
and if not, would indeed attach/include itself prior to
running any macro code?

Also, if an intended user did have an earlier Excel version,
could VBA code be added that could determine the Excel
version and find the correct matching reference in the
library and attach it? For example, while Excel 2003
"matches" with Office Word 11.0 object library, an earlier
Excel version may need a different Word xx.x object in
order to function properly.

Thank you very much.

Ken

Marcster
04-25-2006, 05:11 AM
could you please tell me if there
is any VBA code that could automatically check to see
if the needed library reference was "attached" (included)
and if not, would indeed attach/include itself prior to
running any macro code?

There's some KB entries regarding this,
Here's what I've found:

Add a VBA Reference Library via code
http://vbaexpress.com/kb/getarticle.php?kb_id=267
Remove Missing VBA Library References via code
http://vbaexpress.com/kb/getarticle.php?kb_id=272
Determine the File Path or GUID to a VBA Reference Library
http://vbaexpress.com/kb/getarticle.php?kb_id=278
List all Checked GUIDS
http://vbaexpress.com/kb/getarticle.php?kb_id=713

HTH,

Marcster

JonPeltier
05-04-2006, 06:46 PM
Or you could take the lazy way out, and use late binding. People claim there's a performance penalty, but your users are not likely to notice. Here's a brief introduction:

http://peltiertech.com/Excel/EarlyLateBinding.html

Ken1000
05-04-2006, 09:06 PM
Thank you so very much, Marcster and Jon. Your help is
much appreciated.

Ken

Marcster
05-05-2006, 02:12 AM
I'm glad to be able to help :thumb.
Any other problems/questions, let us know.

Marcster.

geekgirlau
05-09-2006, 06:54 PM
Hi Ken,

Don't forget to mark your post as "Solved" - you can do this via the "Thread Tools" option at the top of the screen.