0
votes

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?

1
What controls do you have on the userform, and are you using 64bit Office?Rory
@Rory: I am using 32-bit office. This project does not have any userform.Python_Student
Why the MSForms reference then?Rory
@Rory: There are some Button, Dropdown controls used in worksheets.Python_Student
Are those the only types of controls? Also, are you sure you deleted all the .exd files on the C drive with all Office applications closed?Rory

1 Answers

0
votes

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