Results 1 to 12 of 12
  1. #1
    Star Lounger
    Join Date
    Feb 2001
    Location
    Springdale, Arkansas
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Angry Excel 2010 showing compile error: "can't find project or library"

    In a basic macro I get the error when I just get the value from a cell.

    I've tried b=range("e12") and b=cells(12,5) and I get this error. This is a new computer with Windows 7 and Office 2010.

    I've already had more problems with this version of Office VBA than any other version.

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,194
    Thanks
    201
    Thanked 785 Times in 719 Posts
    Bill,

    try b=cells(12,5).value or b=Range("E12").value
    Also is B defined as the proper type of variable? Or is it declared {dim} at all?
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  4. #3
    Star Lounger
    Join Date
    Feb 2001
    Location
    Springdale, Arkansas
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No variables are declared... It doesn't really matter what variable I use I get the same error. This worked perfectly in Office 2003.

  5. #4
    Star Lounger
    Join Date
    Feb 2001
    Location
    Springdale, Arkansas
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's making me decalre every variable in the project! Why?

  6. #5
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,194
    Thanks
    201
    Thanked 785 Times in 719 Posts
    Bill,

    Does your module have the statement "Option Explicit" at the top?
    This statement requires the declaration of all variables, and is considered good programming practice. However, if you don't want it you can delete the statement and there is, at least in 2007 and earlier, an option where you can turn it off.
    Attached Images Attached Images
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  7. #6
    Star Lounger
    Join Date
    Feb 2001
    Location
    Springdale, Arkansas
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It is not checked. I made sure of that first.

  8. #7
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,194
    Thanks
    201
    Thanked 785 Times in 719 Posts
    Bill,

    I'm out of ideas. Could you possibly post your module code?
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  9. #8
    Star Lounger
    Join Date
    Feb 2001
    Location
    Springdale, Arkansas
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm finding that if I create a new file it will work fine. Just will not work in existing file with code already in it.

  10. #9
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,194
    Thanks
    201
    Thanked 785 Times in 719 Posts
    Quote Originally Posted by BillSutterfield View Post
    I'm finding that if I create a new file it will work fine. Just will not work in existing file with code already in it.
    Bill,

    When you say "existing file" do you mean one created with a version prior to 2007? If so you need to save it as an .xlsm {macro enabled} file. You probably know this but I'm looking for anything now.
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  11. #10
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,515
    Thanks
    3
    Thanked 143 Times in 136 Posts
    Have a look at the top of the module.
    Does it have a line that says "Option Explicit"? This is the command that forces you to declare every variable in the module - which is good programming practice.

    The error message sounds like you have a missing reference. If it worked previously, you need to check the Tools>References dialog for a reference that is ticked but listed as Missing. If it didn't work previously then you need to post your problem spreadsheet so we can see what the error is.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  12. #11
    Star Lounger
    Join Date
    Feb 2001
    Location
    Springdale, Arkansas
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I do not use Option Explicit. I'm using Excel from Office 2010 and the file was created in Office 2007 and it is an XLSM.
    I moved the forms to a new file and everything works fine now it just took half a day to get it all moved.

    I checked all the references and they matched up.

  13. #12
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    5,895
    Thanks
    0
    Thanked 85 Times in 81 Posts
    What references were checked in the file that had the error? I have only ever seen that error due to a missing reference.
    Regards,
    Rory
    Microsoft MVP - Excel.

Posting Permissions

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