473,657 Members | 2,535 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

adding library references via VBA - worked before but now it doesn't

1 New Member
Hello

I work on a database that needs to work on French and English version of Windows and Office - and work on computers with any combination of Windows 2000, Windows XP, Office 2000, Office XP, Office 2003.

The database was transferable between all of the above but to make it work it was necessary to remove some reference libraries - in particular, Microsoft Excel object library, ADOX and ADOR because they have different locations depending on what combination of systems resided on the computer one was using.

The removing of the reference libaries and reinstalling on startup worked very well for the past 4 years, but now Access, will not allow it. It stops the VBA when it finds reference to Excel objects in the code before it has executed the code to add the object libraries.

The code I am using to add the libraries is as follows:
Expand|Select|Wrap|Line Numbers
  1. Set fs = CreateObject("scripting.filesystemobject")
  2.  
  3. Set ref = Application.References("adodb")
  4. 'if error boolAdd is set to true
  5. If boolAdd Then
  6.     'check to see if it a French system
  7.     If fs.folderexists(strDriveLetter & cstrRoot & cstrComFilFr) Then
  8.         Set ref = Application.References.AddFromFile(strDriveLetter & cstrRoot & cstrComFilFr & cstrSysADO & cstrADO)
  9.     'otherwise set it for English system
  10.     Else
  11.         Set ref = Application.References.AddFromFile(strDriveLetter & cstrRoot & cstrComFil & cstrSysADO & cstrADO)
  12.     End If
  13.     boolAdd = False
  14. End If
  15.  
  16.  
The problem is that VBA now stops the execution of the code because it says excel.worksheet s is a user defined type that is not defined.

Any suggestions?

Thanks
George
Oct 3 '06 #1
1 6518
dima69
181 Recognized Expert New Member
I had the similar problem ones, and I tried to use the similar code to reconnect to library database at startup.
So I've seen two possible scenarios:
1. Access MDB updates the reference by himself, althogh the location is not the same.
2. Access fails to update the reference and raises an error, before the execution of my code.

In both cases, the above code of updating references becomes useless, not to mention it will not work in mde.

I'd suggest to use late binding when possible, especially with Excell.
Oct 3 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4443
by: JD | last post by:
I'm trying to add a custom utility.mde reference to an application from code using the standard Application.References.AddFromFile code. IT has worked really well with A2K for a couple of years but in version 10.0 I'm having a bit of trouble. With the latest Access there are 2 changes that are annoying. First, a 'broken reference' warning popup appears before my code has a chance to resolve the problem. It kinda makes the clients...
7
1324
by: Mathew Hill | last post by:
I am a beginner to the more technical aspects of Microsoft Access (2000) and was wondering if any one can help. I have 3 buttons on a form which add, delete and search for a record. However, when I click on the respective buttons absolutely nothing happens! I was wondering if anyone could help? The code I have is below... ADDING A RECORD Private Sub cmdaddstudent_Click() On Error GoTo Err_cmdaddstudent_Click
9
10887
by: Ben Dewey | last post by:
Project: ---------------------------- I am creating a HTTPS File Transfer App using ASP.NET and C#. I am utilizing ActiveDirectory and windows security to manage the permissions. Why reinvent the wheel, right? Everything so far is working well with the Active Directory. The problem I am having is with adding File Permissions to a directory. I am currently using some code courtesy of "Willy Denoyette "
18
3783
by: Praveen Ramesh | last post by:
Hi, Is there any way to add the @Assembly reference to the aspx files programmatically from inside a custom control (when it gets dropped on to the page from the toolbox)? I have a custom control - MyControl that implements an interface in another custom assembly - InterfaceAssembly. When MyControl gets dropped on to the page and run, it results in a "InterfaceAssembly not found" exception. I am aware that this can be fixed by...
1
994
by: Brian Henry | last post by:
My main project really only has one reference in it that is needed outside of the System references. It references a DLL Class Library which has references in that DLL library to other references like crystal reports and such... I have noticed that my main project though randomly adds copies of the referenced items in the DLL to the exe's reference list... why is it doing this? it doesn't need the references, so why would it copy the...
3
1993
by: _DS | last post by:
The two obvious methods for ref'ing assemblies are: Add a reference and 'Browse' for the actual DLL OR Add existing project to the solution, then add a ref to 'Project'. 1: I'd like to find out what the latter method is doing. I'm assuming that it makes sure that debug exe gets matched to
5
49807
by: Michael Russell | last post by:
Hi all, Using C#, I've created a simple wrapper class for using Excel. I have Office Pro 2003 installed on my devel machine. The wrapper class works great, reading and writing to/from Excel. To do this, I created a reference to "Microsoft Excel 11.0 Object Library", and have a "using Excel;" directive. I decided to add a method for creating a TextBox using the Shapes.AddTextBox method, which requires a
2
2953
by: JB | last post by:
I have existing aspx pages that I'm editing in VS 2005 that I add a server control to - like a label. I include the runat="server" and it doesn't seem to create the reference in the code behind for it. Is there any way to have it automatically generate the code behind? Also - when I look in the .aspx.designer.cs file, there are lots of references to things that were there but have been deleted. Any thoughts?
14
2567
by: Jeroen | last post by:
Hi all, I've got a question about writing a library. Let me characterize that library by the following: * there is a class A which is available to the user * there is a class B that is used in severel 'underwater operations' * there is a list which stores objects of class B There are several issues I'm not sure about:
0
8413
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8617
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.