I get "Compilation Error: Cannot Find Project or Library" only in some versions of Excel 2010. It is difficult to verify this

My client receives a compilation error; Cannot find a project or library in its version of Excel 2010, however I am not getting this in my version of 2010. How can I customize this code so that it does not appear. When an error appears in the following code, the text "cell" in "For each cell in selection" is highlighted:

Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$B$9" Then Columns("D:CB").Select Selection.EntireColumn.Hidden = False Application.ScreenUpdating = False Sheet17.Range("E48:CB48").Select For Each cell In Selection If cell = 0 Then Range(cell.Address).EntireColumn.Hidden = True End If Next Application.ScreenUpdating = True Sheet17.Range("b9").Select End If End Sub` 

My client also reports an error in the following code with the word "Response" highlighted. This is also not a problem for me, in my version of Excel 2010. Any help is appreciated.

 If Sheet1.Range("E18") = 3 Then Response = MsgBox("Reminder Emails have been set to be sent automatically at " & Sheet1.Range("f18").Value & ", " & Sheet1.Range("Q4").Value & " day(s) before" & vbCrLf & "the scheduled appointment. Do you want to send reminder e-mails now anyway?", vbYesNo) If Response = vbNo Then Exit Sub End If End If 
+6
source share
1 answer

In the VBA window, go to Tools --> References and make sure that the same libraries are enabled for all computers. Also make sure all active libraries are in the same order from top to bottom.

Many libraries are "standardized," but perhaps they need to be switched. Or, you may need to reinstall the library link due to functional interference. Perhaps the library is completely absent, but I doubt that it is, because it is a fairly standard set, and you do not know that he was messing with it.

This is a typical problem and, as a rule, is not considered too heavy a load on your distribution clientele. If so, you can redesign your code to use fewer links; or you can download the necessary libraries programmatically (but I have never tried this).

I suggest including Option Explicit at the beginning of all modules. This problem is a bit like refusing to declare variables; and I think this requirement may vary depending on the setting. Option Explicit will force all variables to be declared, which is generally beneficial and may result in all client installations acting the same.

+9
source

Source: https://habr.com/ru/post/920763/


All Articles