PDA

View Full Version : [SOLVED] Compile Errror: Can't Find Project or Library



emosms
01-06-2015, 05:45 AM
P.S. - NOT Initialization, but Declaration
Hi,
A macross I developed home refuses to work at home.
I get the following error:
12684
I get the same on 'for each' loop, so I reworked one loop to have the looped item as Variant, but this is insane, don't want to do this for all loops...
The index loop works if I declare:

Sub test_sql_str()
Dim i As Integer
For i = 1 To 5
Debug.Print "sdf"
Next i
End Sub

Strangely enough, the macros worked as is at home and If I start macro in a fresh excel file, I can use loops as usual.
No need to initialize index and for each variables.

Tried to search descriptevily google about this, but not sure how to formulate the problem.

Regards

Aflatoon
01-06-2015, 06:35 AM
That error is usually down to a Reference problem (in the VB Editor, click Tools - References and look for any checked items that start with 'MISSING:'

However, recent updates to office have caused very odd problems in workbooks that use activex controls - does yours?

emosms
01-06-2015, 07:45 AM
Thx :)
MISSING: Microsoft Windows Common Controls-2.6.0(SP6)
C:Windows\System32\mscomct2.ocx
----
P.S. SOLUTION:
support2.microsoft.com/kb/297381
----
Downloaded the archive and put the files (MSCOMCT2.OCX) where the references dialog showed location for the missing references:
(C:Windows\System32\mscomct2.ocx or wherever the references dialog shows you)
Now works :)

lorein0688
07-17-2017, 03:24 AM
The error occurs as the application has lost the reference to an object or type library resulting in the above error when using Barcode Macros & Native VBA Functions. The problem may be resolved by following the given solution:


1. Open the database or application.
2. Open a module in Design view or press ALT+F11 to switch to the Visual Basic Editor.
3. On the Tools menu, click References.
4. Clear the check box for the type library or object library marked as "Missing:"

Another solution is to remove the reference is to restore the referenced to the path specified in the References dialogue box. If the referenced file is in a new location, clear the "Missing:" reference and create a new reference to the file in its new location.