Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Windows Common Files Directory Location

Status
Not open for further replies.

mveera

Programmer
Nov 6, 2002
81
US
Hi,

I am using ADO and DAO objects in my Excel Application. To use them i add the references

"msado21.tlb" for ADO from c:\Program Files\Common Files\System\ado\ directory
and

"dao360.dll" for DAO from c:\Program Files\Common Files\Microsoft Shared\DAO\ directory.

I would like to automatically include the references on Excel startup in users machine. I would like to know how i can get the Location where the common files are installed, so that i need not hard code the directory location (c:\).

Thanks
Veera
 
If I'm not mistaken the location depends on the machine's O/S.

i.e.

If (InStr(Application.OperatingSystem, "95") > 0) Or (InStr(Application.OperatingSystem, "WINDOWS (32-BIT) 4") > 0) Then
strLibPathADO = "C:\???"
strLibPathDAO = "C:\???"
Else
strLibPathADO = "C:\Program Files\Common Files\System\ADO"

End If
 
Thanks for reply.

My only problem is, will it be always c:\. I read in some article that the location of the common files can be modified while installing. If that is the then checking for OS and setting to C:\ will not work.

That is the reason why i needed a automatic way to determine the location.

Thanks for the reply.

Veera
 
Most shops practice common standards. But it sounds like you are planning to distribute your application publicly.

If so, you might want to explore a method like including the library in your distribution copy and create a registry entry that specifies an alternate location.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top