• Excel 2010 showing compile error: “can’t find project or library”

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Excel 2010 showing compile error: “can’t find project or library”

    Author
    Topic
    #480056

    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.

    Viewing 8 reply threads
    Author
    Replies
    • #1306806

      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?
      :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1306809

      No variables are declared… It doesn’t really matter what variable I use I get the same error. This worked perfectly in Office 2003.

    • #1306813

      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. :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1306814

      It is not checked. I made sure of that first.

    • #1306815

      Bill,

      I’m out of ideas. Could you possibly post your module code? :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1306818

      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.

      • #1306821

        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. 😆 :cheers:

        May the Forces of good computing be with you!

        RG

        PowerShell & VBA Rule!
        Computer Specs

    • #1306822

      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.

    • #1307310

      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.

    • #1307584

      What references were checked in the file that had the error? I have only ever seen that error due to a missing reference.

    Viewing 8 reply threads
    Reply To: Reply #1306821 in Excel 2010 showing compile error: “can’t find project or library”

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel