Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Errors of Adding OWC10 Spreadsheet reference

I use the following code to add the owc10 reference to my project. It
always leads errors on some computers. Your help is highly
appreciated

Dim ref As Object, HasOWC10 As Boolean
For Each ref In ThisWorkbook.VBProject.References
If ref.Name = "OWC10" Then
HasOWC10 = True
End If
Next
If HasOWC10 = False Then ThisWorkbook.VBProject.References.AddFromFile
("C:\Program Files\Common Files\Microsoft Shared\Web Components
\10\OWC10.DLL")

For the computers with such error, I also can not add the reference
mannually IN VBA environment by clicking:

Tools - References - Browse (C:\Program Files\Common Files\Microsoft
Shared\Web Components\10\OWC10.DLL) - OK

gzhu

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Errors of Adding OWC10 Spreadsheet reference

The general problem is that the code references a specific file in a
specific place. Different versions of Excel will have a different name
for "OWC10".
A somewhat more general way of doing this is to use the ".GUID'
property of VBProject.References. This should always work in theory
since the GUID value should be stable across various versions of
Excel. There has been at least on exception to this in Microsoft's
history, but it's a generally much better guess than file name.
The next issue, of course, is that you're trying to assert a reference
based on hard-wired file name and path. This is unlikely to work
across different versions of Excel, and will fail within the same
version of Excel depending on where they installed the program. One
example on the Web about doing this is http://www.vbaexpress.com/kb/getarticle.php?kb_id=267
-- and there are no doubt many others.
HTH

/ Tyla /


On Apr 6, 1:54 pm, "Bula" wrote:
I use the following code to add the owc10 reference to my project. It
always leads errors on some computers. Your help is highly
appreciated

Dim ref As Object, HasOWC10 As Boolean
For Each ref In ThisWorkbook.VBProject.References
If ref.Name = "OWC10" Then
HasOWC10 = True
End If
Next
If HasOWC10 = False Then ThisWorkbook.VBProject.References.AddFromFile
("C:\Program Files\Common Files\Microsoft Shared\Web Components
\10\OWC10.DLL")

For the computers with such error, I also can not add the reference
mannually IN VBA environment by clicking:

Tools - References - Browse (C:\Program Files\Common Files\Microsoft
Shared\Web Components\10\OWC10.DLL) - OK

gzhu



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Errors of Adding OWC10 Spreadsheet reference

That's great. Thank you alot, Tyla!

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
#REF! - Invalid Cell Reference Errors Techdewd49 Setting up and Configuration of Excel 1 April 21st 08 12:15 AM
Pivot Bar Chart - adding errors? Roge Charts and Charting in Excel 0 June 20th 06 02:28 PM
Errors in VB Code since adding macro Susan Excel Discussion (Misc queries) 1 April 11th 06 08:42 PM
Ignoring reference errors Mike Jerakis Excel Programming 3 January 3rd 06 07:02 PM
ComboBox RowSource --- can I use a userform OWC10 spreadsheet range? Dean Frazier Excel Programming 0 February 11th 04 07:16 PM


All times are GMT +1. The time now is 03:48 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"