+ Reply to Thread
Results 1 to 35 of 35

Compile Error: Can't find project or library (1 computer has the error, another does not?)

  1. #1
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Compile Error: Can't find project or library (1 computer has the error, another does not?)

    I have a request form that has been used by two departments for the past two years. After we went through an upgrade from Office 2007 to Office 2010, Department A is still able to use the form, while Department B receives the message "Compile Error: Can't find project or library". I have attached to this post a copy of the form, and a screenshot of the error being received by Department B. The form itself is much more complicated, but this is a simplified version that saves the PDF to your desktop so that it can be tested by anyone. If I can fix the error on this one, I should be able to incorporate the solution into the more complicated version.

    Thanks in advance for any help that comes my way!

    Screenshot of the Compile Error >>> Compile Error.jpg

    Please Login or Register  to view this content.
    Last edited by jonvanwyk; 06-28-2012 at 01:02 PM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Hi jonvanwyk
    The error you're receiving usually indicates a missing reference. I'd guess it's the Calendar Control as it's not included with Excel 2010. On the offending machine in VBA go to Tools ----> References and see if any are missing. If it is the Calendar Control you can download it from several sites. You may wish to explore options to Calendar Control...there are several good ones available.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    See VBA\Tools\References Screenshot >>> Calendar Control Screenshot.jpg

    @jaslake: Thank you for your reply. It has been harder than normal to get help on this question. I did as you asked, except it was not on the offending machine, but on the machine on which the form works fine. It appears that Calendar Control is not on this machine either, and does not seem to affect anything in this particular form. Thoughts?

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Hi jonvanwyk

    I'm unable to duplicate the error for either file in Excel 2007 or Excel 2010. I deleted the Reference to Calendar Control and both ran fine. Do you have ANY References on either machine that are marked MISSING?

  5. #5
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    I also cannot seem to duplicate the error, except when I am using a computer in the other department. Both departments have the same excel add-ins. I am completely stumped.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Hello Dutch,

    Check that the offending machine has VBA macros enabled and the Trust Centers are setup correctly for macros. The Left function is part of the VBA library. To check that this in fact the problem, prefix the Left with VBA (see the code below). If after the change, it errors at a different point, then it is confirmed that VBA library is not loading or loading incorrectly.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    @Leith...Thanks for dropping in :-) I will check that this morning when the other department opens. Is it possible for all macros to be enabled, and the document to be trusted, and to still have issues with such a thing? If so, how does one fix that problem (and how likely would it be the the problem would exist on every machine in the other department)?

    I should note that the actual code is a bit more complicated. Below is a sample of it in which the compile error first started with the [A50]. Someone recommended that I change the [A50] to "A50". When I did so, the form stopped working on the machines in our department. When used at the other department, it also did not work, but the error jumped from [A50] to the "Left(" error you see now.

    Please Login or Register  to view this content.
    I have attached the unadulterated form to this reply. It contains real email addresses in it, so I trust anyone looking at it will be careful in using it (though I am sure it wouldn't work for anyone else anyway given that the file name paths are specific to our network).

    Records Request Form Excel 2003 Workbook.xls
    Last edited by jonvanwyk; 06-27-2012 at 08:42 AM.

  8. #8
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    @Leith: Okay, well...I attempted your code at the other department on the simplified version. I received no errors and the form functioned as intended. Should I just add "VBA.Left" whereever that code is on the more complicated form and call it good (if it also makes the the real form work properly)?

  9. #9
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    PS.

    Why do you use the variable filename ?
    there's more robust code for that:
    Please Login or Register  to view this content.
    You can avoid the 'Left' issue.

    To 'print' the PDF I think this will suffice:

    Please Login or Register  to view this content.
    Last edited by snb; 06-27-2012 at 11:00 AM.



  10. #10
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    I have attached additional tested files below.

    "Records Request Form Test A.xls" works perfectly on computers in my department. When I attempt to use it in the other department, I receive the error seen in the screenshot below (Compile Error 1).

    Although perhaps misconceived, "Records Request Form Test B.xls" attemps to accomodate Compile Error 1 by changing, for example, [A50] to "A50". When this is done, the form no longer works in our department, and when attempted in the other department, I receive the error seen in the screenshot attached below (Compile Error 2). Since I added "VBA." to "Left", the error jumps to "Environ" found at the bottom of Module 1 under the function "Function RDB_Create_PDF".

    Thoughts? I really appreciate your guys' help. I still do not know why this is happening. :|
    Attached Images Attached Images
    Attached Files Attached Files

  11. #11
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    @snb: Why do I use ANY code? Because it is all cannibalized from various examples throughout the web to create a form that meets my needs. I am sure there is a lot of code I use that could be made more efficient, but at my skill level I have a tendancey to follow the axiom "If it ain't broke, don't fix it."

    Until the other department underwent their Office 2010 upgrade, the form worked great in both departments. After they went through their upgrade, it stopped working on their computers. Our department went through the same software upgrade shortly after, yet we have no issues with the form working perfectly. I am really confused.

  12. #12
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    I think you could create a new Excel document on the computer that produces the errors and copy your code into it.
    It might work.
    Although you may think you work with identical software, sometimes 'updates' can interfere.

  13. #13
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    @snb. I can try that, though I am not excited about it. The copying and pasting of the VBA is easy enough, but that means I have to create the spreadsheet all over again. *sigh I wonder why the bracketed cell references are giving an error.

  14. #14
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    The copying and pasting of the VBA is easy enough, but that means I have to create the spreadsheet all over again
    I doubt that.

    What happens if you replace [A50] by Range("A50")

  15. #15
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    @snb: That is the only difference between Test A and Test B forms (attached to my previous reply). Test A has it as [A50] and Test B has it as "A50". In Test A, the form works perfectly in our department while Test B does not. Neither Test A nor Test B works at the other department, though they get different errors. (Read reply #10 ...it goes into more detail.)

  16. #16
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Well, back to lesson 1 in VBA:

    You can't use
    If ("A50" = True) And

    You can use
    If Range("A50").value = True And

    But you'd better use a reference to the sheet also:

    Please Login or Register  to view this content.
    And you'd better avoid sheetnames that can be mixed with other things in VBA, e.g. a Usrform with a name "Form1"
    Caal them "Sheet_1", "Sheet_2", etc.
    Last edited by snb; 06-27-2012 at 01:05 PM.

  17. #17
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    I skipped "lesson 1"...went straight to "trial by fire" haha. I will create a new document labeled Test C and get back to everyone.

  18. #18
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Thanks snb. I have made those changes (see attached file). I am going to test it over at the other department in a minute to see if that fixes the issue they were having. I get back to you.
    Attached Files Attached Files
    Last edited by jonvanwyk; 06-27-2012 at 02:33 PM. Reason: clarity

  19. #19
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    The new and improved "Records Request Form Test C" works perfectly in our department, but gets the error below when used in the other department.

    Please Login or Register  to view this content.

    compileerror3.jpg
    Last edited by jonvanwyk; 06-27-2012 at 03:17 PM.

  20. #20
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Further research suggests that the "MISSING: Microsoft Office Calendar Control 2007" on the offending computers might be the issue? The machines in our department (on which the form words perfectly) all have "Microsoft Calendar Control 9.0".

    MISSING - Microsoft Calendar Control 2007.jpg
    Last edited by jonvanwyk; 06-27-2012 at 04:14 PM.

  21. #21
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Hi jonvanwyk
    YES!!! I believe I mentioned this previously.

    You MAY be able to copy the Calendar Control from another machine...don't know. You CAN, however, download a copy and do the install. See this link and follow the instructions carefully.
    http://www.excelforum.com/excel-prog...r-library.html

    If you're distributing see this link for an alternative to Calendar Control
    http://www.excelforum.com/excel-prog...r-control.html

    You may try simply unchecking the missing control...see if your code runs...if not do the download.
    Last edited by jaslake; 06-27-2012 at 04:43 PM.

  22. #22
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Hello Dutch,

    I have been doing a lot of reading as to why this problem maybe occurring. At this time, I haven't found any known issues with Excel 2003, 2007, or 2010 relating to this. The Environ method is also part of VBA. You can add the VBA prefix as before with Left. This should work. You can use CTRL+F to do a find and replace through out your project if there are several of these references in your code.

    Strange thing is the brackets like [A1] did not change in either 2007 or 2010 from Excel 2003. Both versions support this short hand for the Evaluate method, which is part of the Excel application and not VBA. Perhaps it is related to the network setup. I'll keep looking.

  23. #23
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    @jaslake: The code I seem to be having issues with does not seem like it would even need calendar control, so I am still not convinced that this is the problem. That said, the only difference between the machines in our department and the machines in the other department is that we have Microsoft Calendar Control 9.0 on our machines, and they do not.

    @Leith: I will add the VBA prefix before the Environ (it only shows up twice in my code) and see if that ends the errors experienced at the other department.

  24. #24
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Hi jonvanwyk

    Did you clear the MISSING item in Tools--->References to see if this resolved the issue?

  25. #25
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    @jaslake: Our IT department didn't want to add Calendar Control to the offending machine, and I do not have administrative rights. So I figured if I cannot make their machines look like ours, I will make my machine look like theirs. Upon removing Calendar Control 9.0 from my machine; my form still works perfectly fine. I got to thinking about how none of the code in my form should really need calendar control, and it was the only thing labled as "Missing" on their VBA References. I can only assume that their machines have a different form that they use that is causing that...but I doubt it is related to my form at this point. I have added the VBA.Environ to resolve that issue. I will test it after the other department opens to see if any other errors pop-up after that one is resolved and get back to everyone on the forum.

  26. #26
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    In the earliest versions of Excel 2007 the PDFwriter wasn't built in. You had to install that 'addin'.
    The later versions contained the ThisWorkbook.ExportAsFixedFormat.

    So if you are working in Excel 2007 and Excel 2010 the check whether the PDF addin has heen installed should be redundant.

    If you skipped lesson 1 in VBA it might occur that the userform/sheet contains more controls than you are able to see. You could check that too.

  27. #27
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    @snb: The form was originally created when both departments were using Office 2007. Both departments underwent an upgrade to Office 2010. The form now works in our department, but not the other department. Everyone is on Office 2010 now.

  28. #28
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Hi jonvanwyk

    Did you clear the MISSING item in Tools--->References to see if this resolved the issue?

  29. #29
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    Adding the VBA. to the Environ fixed the remaining errors and the form now works as intended at the other department. So, after ALL of that, all I did to get it working was to add VBA. to the "Left" and VBA. to the "Environ". Thus, I still do not know what the problem was, but the solution seems to work lol. Thanks again everyone!

  30. #30
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    The form now works in our department, but not the other department. Everyone is on Office 2010 now.
    So no use to check the existence of any addin to produce PDF's.

  31. #31
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    I knew I acted too quickly in marking this thread as solved! Darn. Okay, so the form is error free, but since having changed [A50] to Range("A50") ... and so on ... the form no longer picks and chooses who to send the request to based on what is = TRUE. Instead, it sends the request to EVERYONE no matter what is clicked. Nothing like having 17 people from 5 agencies reply to your email saying "Why am I getting this?".

    Thoughts?

  32. #32
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    You made a refence to the VBA library by adding VBA. to the left side.
    You could consider to add reference to the sheet you are referring to when adressing ranges.

    Sheets("Sheet1").Range("A50").value is to be preferred instead of Range("A50").
    You can use With ... End With to shorten your code (lesson 3 in VBA )

  33. #33
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    There IS only one sheet though.

  34. #34
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    There's also only one VBA library....

  35. #35
    Forum Contributor jonvanwyk's Avatar
    Join Date
    06-28-2010
    Location
    Iowa, USA
    MS-Off Ver
    Excel 2010
    Posts
    452

    Re: Compile Error: Can't find project or library (1 computer has the error, another does n

    I went back to the [A50] syntax and it seems to work fine now. Who knows.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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