+ Reply to Thread
Results 1 to 15 of 15

Compile Error: Can't find project or libray

  1. #1
    Registered User
    Join Date
    07-29-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    16

    Compile Error: Can't find project or libray

    Hi all,

    a few weeks ago with the help of Olly and others, we managed to write a small macro that allow you to select a few options and paste to specific cells. With a second macro i am able to filter using more than 2 options. Everything works fine and I also managed to add/modify what I needed in terms of options.

    However, on another pc with same version of excel I get the error 'Compile Error: Can't find project or library' and it highlights Dim ctrl As Control in the btOK_click() bit. Here is the code

    Private Sub btCancel_Click()
    Unload Me
    End Sub

    Private Sub btOK_Click()
    Dim ctrl As Control
    Dim s() As String
    Dim i As Integer

    i = 0

    For Each ctrl In Me.Controls
    If TypeName(ctrl) = "CheckBox" Then
    If ctrl.Value Then
    i = i + 1
    ReDim Preserve s(1 To i)
    s(i) = ctrl.Caption
    End If
    End If
    Next ctrl

    If Not Me.RefEdit1.Value = "" Then
    Range(Me.RefEdit1.Value).Value = Join(s, ", ")
    Unload Me
    Else
    MsgBox "No range selected", vbCritical + vbOKOnly
    End If
    End Sub

    Private Sub CheckBox1_Click()

    End Sub

    Private Sub CheckBox10_Click()

    End Sub

    Private Sub CheckBox12_Click()

    End Sub

    Private Sub CheckBox2_Click()

    End Sub

    Private Sub CheckBox3_Click()

    End Sub

    Private Sub CheckBox4_Click()

    End Sub

    Private Sub CheckBox5_Click()

    End Sub

    Private Sub CheckBox6_Click()

    End Sub

    Private Sub CheckBox7_Click()

    End Sub

    Private Sub CheckBox8_Click()

    End Sub

    Private Sub CheckBox9_Click()

    End Sub

    Private Sub Label1_Click()

    End Sub

    Private Sub RefEdit1_BeforeDragOver(Cancel As Boolean, ByVal Data As MSForms.DataObject, ByVal x As stdole.OLE_XPOS_CONTAINER, ByVal y As stdole.OLE_YPOS_CONTAINER, ByVal DragState As MSForms.fmDragState, Effect As MSForms.fmDropEffect, ByVal Shift As Integer)

    End Sub


    It works perfectly fine for me on my computer so I am not sure what the problem is and how I can avoid as It is a file that should be used by a few user
    As always, every help is HIGHLY appreciated!Thanks a lot guys

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Compile Error: Can't find project or libray

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

  3. #3
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Compile Error: Can't find project or libray

    Hi,

    Please check under Tools -> References in the VB Editor. Are any of the selected references shown with MISSING: at the beginning?
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  4. #4
    Registered User
    Join Date
    07-29-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    16

    Re: Compile Error: Can't find project or libray

    Norie

    Sorry, I didnt know I had to use tags for the code, I am new here. I will try to upload a sample workbook

    xlnitwit
    I tried to do that on the computer giving me the error but I cant open the references in VBA, it is not an option I can click on. again, not sure why

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Compile Error: Can't find project or libray

    You must make sure there is no code running at the time.

  6. #6
    Registered User
    Join Date
    07-29-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    16

    Re: Compile Error: Can't find project or libray

    Ok got it (sorry about this)

    the problem is

    MISSING: Windows common controls-2 6.0 (sp6)

    I also tested it on another pc and it had the same problem. I found a quick fix on internet which basically consist in

    Create a new form object, then while in design mode, create a new ActiveX object (ie: TreeView or ListView) on the Form object. Save the Form object, then delete it.

    I suspect this will work on the pc with problems. The reason why it is missing is probably because they never had to use VBA/Macro and it didnt automatically refresh as I did when I started using it. I might be wrong but I will find out very soon.

    Is there any work around to avoid this issue ? That would save me from going changing setting on every pc manually.

    thanks a lot everyone !!

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Compile Error: Can't find project or libray

    Does your workbook actually use any controls from that library? If it doesn't you could simply uncheck the reference in order to avoid the problem.

  8. #8
    Registered User
    Join Date
    07-29-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    16

    Re: Compile Error: Can't find project or libray

    I uploaded a sample of my workbook. Again, it works perfectly fine on my pc but others are missing this windows common controls-2 6.0 (SP6).

    I wonder if there is any way of avoiding this problem. Worst case I will have to do that procedure on the pc they need to use for the time being

    Thanks for your being patient !
    Attached Files Attached Files

  9. #9
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Compile Error: Can't find project or libray

    You do not in fact appear to require that reference at all so I suggest you remove it. Problem solved.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Compile Error: Can't find project or libray

    When I uncheck the Windows Common Controls-2 6.0 (SP6) in the attached workbook everything appears to work without problem.

    I think you need to check if that reference is actually required.

    If it isn't just uncheck it in the original workbook, save that workbook and redistribute it.

  11. #11
    Registered User
    Join Date
    07-29-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    16

    Re: Compile Error: Can't find project or libray

    Err sorry you lost me (again)

    What do I remove exactly ? You mean from the code ? isnt that referred to the active form (the button basically) ?
    What do I remove from the code exactly ?

  12. #12
    Registered User
    Join Date
    07-29-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    16

    Re: Compile Error: Can't find project or libray

    You mean by simply removing the tick on the missing one when in tool - > References and re open the file ?

  13. #13
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Compile Error: Can't find project or libray

    Quote Originally Posted by lukas844 View Post
    You mean by simply removing the tick on the missing one when in tool - > References and re open the file ?
    Yes that is correct. Be sure to save the file.

  14. #14
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Compile Error: Can't find project or libray

    Remove the tick, save the file and then re-open.

    That should work because you don't actually appear to be using any control from the problem library, ie Windows Common Controls-2 6.0 (SP6).

    You might have temporarily used something from it in the workbook in the past and the reference has been saved when you saved the workbook.

  15. #15
    Registered User
    Join Date
    07-29-2016
    Location
    london
    MS-Off Ver
    2010
    Posts
    16

    Re: Compile Error: Can't find project or libray

    Ok thank you guys !!
    It should work now, thanks a lot for your help !

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Error in function Compile error: Can't find project or library
    By Motario1 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 12-12-2013, 02:20 AM
  2. Compile Error: Can't find project or library
    By sugaprasad in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-30-2013, 07:25 AM
  3. [SOLVED] Compile Error in Hidden Module and Compile Error: Can't find project or library
    By Taislin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2013, 07:03 PM
  4. [SOLVED] Compile Error: Can't find project or library (1 computer has the error, another does not?)
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 06-28-2012, 12:09 PM
  5. Compile error: can't find project or library
    By smart_as in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-14-2011, 06:45 AM
  6. Compile Error: Can't find project or library
    By gone83 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-13-2011, 09:23 PM
  7. Compile Error - Can't find project or Library
    By bmasella in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2007, 07:55 PM
  8. [SOLVED] Compile error: Can't find project or library
    By Vince in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2005, 12:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1