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:
- Visual Basic for Applications.
- Microsoft Excel 15.0 Object Library.
- Microsoft Forms 2.0 Object Library.
- Microsoft Office 15.0 Object Library.
- 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?