Microsoft Activex Data Objects Versions
The ADO version depends on your Windows operating system, viz. Microsoft ActiveX Data Objects 6.1 Library for Windows 7 or later, Microsoft ActiveX Data Objects 6.0 Library for Windows Vista, and Microsoft ActiveX Data Objects 2.8 Library for Windows XP. ActiveX Data Objects (ADO) In the File version resource description column below, two values have special meanings: (empty) means the file would normally have a description string contained in the file version resource (Portable Executable format), but no description was found in this file. (N/A) means the file does not normally contain a file version resource. - Microsoft ActiveX Data Objects 2.7 Library - Microsoft ActiveX Data Objects 2.8 Library Currently I have referenced 2.1 and am using a disconnected recordset (no database) which is saved into a file using adPersistADTG, then subsequently Opened in another session. I note that Windows 2000, XP and so on have a version of MDAC.
I always added references into my .bas module through 'Tools...->References...'. And now I want to add references automatically, using macro code. I need to add the two references: Microsoft ActiveX Data Objects 6.1 Library
and Microsoft VBScript Regular Expressions 5.5
. And I found a piece of code that seems to do what I want:
But I don't know how to get paths of files (PATH_TO_FILE
). Maybe somebody can help me? Thanks in advance.
1 Answer
You can find the file path on the References VBAProject dialog (Tools >> References). Look for the location property.
EDIT: As pointed out in the comments, you cannot always read the full name. This sub outputs all the current references.
Warning
You should really read @MacroMan's comment on the OP. Although you can update references programmatically, you probably shouldn't.
destination-datadestination-dataNot the answer you're looking for? Browse other questions tagged vbaexcel-vbaexcel or ask your own question.
Hello,
I use the Microsoft ActiveX Data Objects Library to connect to our SQL server to run queries against tables and return the desired results for reporting.
Issue I am running into is this. I primarily use the 2.8 Library, but need to create a 2.7 Library version of the xlsm since some users will get an error message on the 2.8 Library version of the xlsm. On the PCs that have issues, I have run the MDAC_Type.exe for the 2.8 update and that has NOT corrected the problem and on some PCs, it will not run (Not compatible). Our environment is XP Pro and WIn 7 Pro, and I will get errors on both OS for both Libraries.
It is very frustrating to maintain 2 versions of a xlsm just to ensure that all of the users can use one or the other to avoid an error message.
This is the basic code I use to setup my connection and run my query. The error always occurs at the dbConn.Open myConn line in the code.
'ADD ADO Reference
myServer = 'SERVERXX'
myDB = 'XXXX'
Set dbConn = New ADODB.Connection
myConn = 'PROVIDER=SQLOLEDB;Integrated Security=SSPI;Persist Security Info=False;'
myConn = myConn & 'DATA SOURCE=' & myServer & ';INITIAL CATALOG=' & myDB & ';'
dbConn.Open myConn
myQuery = 'select * from Table'
Set myRS = New ADODB.Recordset
With myRS
.ActiveConnection = dbConn
.Open myQuery
End With
Do Until myRS.EOF
userID = myRS.Fields(0).Value
myRS.MoveNext
Loop
myRS.Close
dbConn.Close
The ADO Reference that I use will be either the Microsoft ActiveX Data Object 2.8 Library or the Microsoft ActiveX Data Object 2.7 Library and append the file names with either (2.8).xlsm or (2.7).xlsm to distinguish between the two.
Any help in getting this issue resolved will be GREATLY appreciated. I would like to use the 2.8 library all the time and need to know what needs to be done on the PCs that get an error with that library.
Microsoft Activex Data Objects Versions List
The error message for those that get the error:
Title: Microsoft Visual Basic for Applications
Message: Class does not support Automation or does not support expected interface.
Activexobject Javascript Methods
AGAIN, I have run the latest MDAC update on those PCs that get the error and it either has not worked, or will error out with a message stating it is not supported.
Microsoft Ado
Please help me... THANKS!!
Microsoft Activex Data Objects Versions Free
PS - I am sorry if I missed including any vital information. I did my best to include all relevant facts.