Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Add references

Is it possible to add a reference to Current version of Word object library
by using VBA on startup of a file?

KS


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Add references

Hello
Try:
ThisWorkbook.VBProject.References.AddFromFile (Application.Path &
"\MSWORD.OLB")

Amend the MSWORD.OLB file name with relevant file name according to version
(eg MSWORD9.OLB for Word 2000)

HTH
Cordially
Pascal

"Kent Schederin" a écrit dans le message de
...
Is it possible to add a reference to Current version of Word object

library
by using VBA on startup of a file?

KS




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Add references

I don't think I'd do this (even if I knew how!):

I think you want to use something called late-binding. Instead of relying on a
specific version, you create a "version-independent" object that doesn't use
references.

Tom Ogilvy posted this recently:

Here are some more extensive references on binding:

Use late binding - don't have a reference to excel.

http://support.microsoft.com/default...b;EN-US;244167
INFO: Writing Automation Clients for Multiple Office Versions

http://support.microsoft.com/default...b;en-us;245115
INFO: Using Early Binding and Late Binding in Automation

http://support.microsoft.com/default...b;en-us;247579
INFO: Use DISPID Binding to Automate Office Applications Whenever Possible

However, if the problem is caused by going from a newer version of Excel to
an older version, the solution might be to do the development on the oldest
version.

=============

Also, Dick Kusleika has a web page at:
http://www.dicks-clicks.com/excel/olBinding.htm
that explains this difference when using Outlook

It's very nice to use early binding when developing. You get all the
intellisense help (when you set the reference and declare the variables
nicely). But before you distribute it to users (who may be using different
versions), it's usually a good idea to use latebinding (and change those object
variable declarations to the generic "As Object".)


Kent Schederin wrote:

Is it possible to add a reference to Current version of Word object library
by using VBA on startup of a file?

KS


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Add references

Hello Dave
Yes this is definitely true in case of different Office versions
I forgot to mention to Kent that the example I provided should only be used
with a known version of Office
Thanks for the valuable links provided.

Cordially
Pascal

"Dave Peterson" a écrit dans le message de
...
I don't think I'd do this (even if I knew how!):

I think you want to use something called late-binding. Instead of relying

on a
specific version, you create a "version-independent" object that doesn't

use
references.

Tom Ogilvy posted this recently:

Here are some more extensive references on binding:

Use late binding - don't have a reference to excel.

http://support.microsoft.com/default...b;EN-US;244167
INFO: Writing Automation Clients for Multiple Office Versions

http://support.microsoft.com/default...b;en-us;245115
INFO: Using Early Binding and Late Binding in Automation

http://support.microsoft.com/default...b;en-us;247579
INFO: Use DISPID Binding to Automate Office Applications Whenever Possible

However, if the problem is caused by going from a newer version of Excel

to
an older version, the solution might be to do the development on the

oldest
version.

=============

Also, Dick Kusleika has a web page at:
http://www.dicks-clicks.com/excel/olBinding.htm
that explains this difference when using Outlook

It's very nice to use early binding when developing. You get all the
intellisense help (when you set the reference and declare the variables
nicely). But before you distribute it to users (who may be using

different
versions), it's usually a good idea to use latebinding (and change those

object
variable declarations to the generic "As Object".)


Kent Schederin wrote:

Is it possible to add a reference to Current version of Word object

library
by using VBA on startup of a file?

KS


--

Dave Peterson



Reply
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
How to convert all 3d references to normal references in a workboo Dima Excel Discussion (Misc queries) 6 August 8th 08 12:38 PM
How to convert all 3d references to normal references in a workboo Dima Excel Worksheet Functions 6 August 8th 08 12:38 PM
Help with converting a block of cells with Absolute and mixed references to relative references Vulcan Excel Worksheet Functions 3 December 13th 07 11:43 PM
How to rename references from range names to cell references Abbas Excel Discussion (Misc queries) 1 May 24th 06 06:18 PM
Tools | References - information about references L Mehl Excel Programming 6 July 4th 04 06:28 PM


All times are GMT +1. The time now is 04:20 PM.

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

About Us

"It's about Microsoft Excel"