ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reference. (https://www.excelbanter.com/excel-programming/327487-reference.html)

Tom

Reference.
 
Hello,

how can I by macro add and remove thit refernces:

Microsoft Word X.0 Object Library
C:\Program Files\Microsoft Office\OfficeX\MSWORD.OLB

x - menas 10 or 11, thats the problem I need this reference switch by
version of Office

I hope somebady help me.

Thanks tom



keepITcool

Reference.
 

IMO there is NO need to switch references, just make sure
that you get no compile errors in either version.
(very likely the oldest)

OR use latebound code....


if you still want to change /add references you MUST be sure
that users have "Allow access to visual basic project"
enabled...
(and from Office 2003 you can only change this via the registry)


then you can access refs via
Application.VBE.ActiveVBproject.References
It may be a good idea to add a reference to VB Extensibility.

But as I said there is NO need.



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Tom wrote :

Hello,

how can I by macro add and remove thit refernces:

Microsoft Word X.0 Object Library
C:\Program Files\Microsoft Office\OfficeX\MSWORD.OLB

x - menas 10 or 11, thats the problem I need this reference switch by
version of Office

I hope somebady help me.

Thanks tom


Harald Staff

Reference.
 
Hi Tom

You are best off using "late binding" for this. Which usually means that you
replace all known hardcoded object types with simply "Object" and let
Windows and the registry do the detective work. See
http://erlandsendata.no/english/inde...baoleolebasics

HTH. Best wishes Harald

"Tom" skrev i melding
...
Hello,

how can I by macro add and remove thit refernces:

Microsoft Word X.0 Object Library
C:\Program Files\Microsoft Office\OfficeX\MSWORD.OLB

x - menas 10 or 11, thats the problem I need this reference switch by
version of Office

I hope somebady help me.

Thanks tom





Harald Staff

Reference.
 
"NO need" isn't always generally true -but I haven't tested this on Office
libraries.
I have excel files that are used by multiple users, and it has reference to
ADO. I wrote and compiled it using ADO 2.1. One of our users had an upgrade
to ADO 2.5. The file upgraded the reference, remembered it on Save and
expected 2.5 next time it ran. After that it refused to run on a 2.1 machine
even without 2.5 spesific objects or commands in the code.

They don't call it "dll hell" for nothing, there is at least a potential
problem somewhere :-)

Best wishes Harald

"keepITcool" skrev i melding
ft.com...

IMO there is NO need to switch references, just make sure
that you get no compile errors in either version.
(very likely the oldest)





All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com