LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default VBA References - when is Office Object Library Reference set? Best practice re. Early/Late binding ...

Problem : When is the reference to the correct version of the MS Office Library set up in Excel? I can get MISSING references in certain circumstances and not others..

What is the accepted best practice for producing VBA code that will run in other (earlier or later) versions of Office

Details

I have a set of workbooks and an AdddIn that I have developed in Excel 2003. A lot of my end users use Office XP/ 2000. My code is set up with a reference to "MS Office 11.0 Object Library", and works fine (in order to do custom menus). When a user with an earlier version of office runs the code, it works fine and these references are automagically converted to "MS Office 10.0/9.0 Object Library" as appropriate, which I understand is the expected behaviour

I use Early Binding, so need the correct reference in order for the code to compile. I understand that I could make my code immune to Office version by converting to Late Binding and I understand how to do this, but I'm reluctant to do it, as I like to be able to use the nice features such as Intellisense, pre-defined constant values etc., and there are no dependencies on any particular version in the code

If everything is OK, why am I worried? ... Well, none of my end users have yet experienced a problem, but I have simulated a problem in testing (investigating a different installation issue), and I would like the group's advice on whether I should be concerned or not

If I set up my test system with Win2000/OfficeXP, and Office XP is set up to install everything on first use, then install my stuff (basically a set of workbooks plus addin), I find that the VBA will not compile, because the projects are still referencing the Office 11.0 object library and no reference has been set up to the Office 10.0 library

I can manually fix this by unchecking the Office 11.0 reference and adding the Office 10.0 reference, and then everything will work fine from then on.

Also, on Office XP installations that use the default installation options (rather than install on first use), the Office 10.0 reference is already there before I install my stuff and the correct reference is automagically used

Some of my users will have had their Office installed from an administrative install where the install-on-demand feature has been set and so could get the same problem

So my ultimate question is - Can I expect that the correct reference will have usually been set by normal use of Excel before I install my stuff, or do I need to take precautions to avoid this potential problem? The precaution/workaround could be as simple as asking the user to invoke a certain feature of Excel to provoke the setting of the correct reference if they encounter the problem ..

Any and all advice would be gratefully received, thank

Andy

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Late Binding issue with Excel.Application object [email protected][_2_] Excel Discussion (Misc queries) 2 August 4th 09 08:10 AM
Late binding to Excel from Access causing Object error EagleOne@microsoftdiscussiongroups[_2_] Excel Discussion (Misc queries) 4 June 14th 08 12:45 AM
VB Extensibility library and "late binding" Dennis Excel Discussion (Misc queries) 0 March 30th 05 10:51 PM
EARLY binding or LATE binding ? jason Excel Programming 6 February 26th 04 04:57 PM
Early vs Late Binding - Word John Wilson Excel Programming 6 November 13th 03 03:21 PM


All times are GMT +1. The time now is 04:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"