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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Compile Error: Can't Find Project or Library excel

Status
Not open for further replies.

sahmiele

Technical User
Sep 9, 2003
67
US
I have an excel file with some macros and forms in it that I have emailed to some external users and are getting the above message. I have searched the error and have found the solution, but I don't want to have to walk 100 users who don't have a strong grasp of computers through the steps of going into vb, "click tools", then click references, and update the missing ones. is there a way I can adjust the macros to address this on my end so they don't get that message? Thanks in advance!
 
Private Sub AddLibraryReferences()
Dim xObject As Object

On Error Resume Next

With ThisWorkbook.VBProject

Set xObject = .References.Item("crystal")
.References.AddFromFile("FullPath\FileName.xla")

End With
End Sub

Add code to Workbook_Open() and redistribute files. I'd add a test with a message in case the Library can't be found on the machine to do something.

 
Check to make sure they have the same version. I have had this happen several times where my version was one higher then the user.
 
FXP, what is "crystal"? is this the missing library?
 
Sorry about that -- crystal is the file name that would appears in the Reference list.
 
so, it should look like this:

with ThisWorkbook.vbproject
Set xObject = .References.Item("ordering")
.References.AddFromFile("c:\my orders\ordering.xls")

End with

Correct?

 
You need some error handling here because an error will crash the function. Also, you need an xla or dll file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top