Python_Student
Python_Student

Reputation: 137

Object Library Invalid error in Excel 2013

I am trying to run an Excel macro developed using Excel 2010. It used to work fine before installing Office 2013. After installing Office 2013, I got this compiler error:

"Compiler Error in hidden module: modFunc. This error commonly occurs when code is incompatible, with the version, platform, or architecture of this application."

Since the VBA project was locked earlier I 'unprotected/unlocked' the project. After this I started getting this error:

"Method or Data Member not Found "

I added this code in my module:

#If VBA7 Then
    Private Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal ms As LongPtr)
#Else
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
#End If

Now when I compile the VBA project, I get this compile error:

"Object library invalid or contains references to object definitions that could not be found"

The following references in the project:

  1. Visual Basic for Applications.
  2. Microsoft Excel 15.0 Object Library.
  3. Microsoft Forms 2.0 Object Library.
  4. Microsoft Office 15.0 Object Library.
  5. OLE Automation

I have already tried deleting all the .exd files by DEL /S /A:H /A:-H *.EXD. Also tried unregistering and registering 'mscomctl.ocx'.

None of these solutions seem to be working for me. This macro works fine on a few machines but not on others.

I have been getting the "Object library invalid" error for a while now.

Does anyone have a solution for this?

Upvotes: 0

Views: 1391

Answers (1)

Raj K
Raj K

Reputation: 1

Similar error I was receiving. Some files were made initially in Office 2007 with macro giving error on Office 2013.

Simplest turnaround was that open in office 2010 , save and then open in office 2013.

It worked for 10 of my different files, which were initially refused to open in office 2013

Upvotes: 0

Related Questions