'Automation error Library not registered' 当 运行 Excel 2016 VBA 项目 2010

'Automation error Library not registered' when running Excel 2016 VBA with Project 2010

我刚刚尝试了所有方法,但没有任何效果。

这是我的代码的开头:

 Public Sub Connect()

    Dim appProj As MSProject.Application
    Dim Resp As Variant

       Set appProj = CreateObject("Msproject.Application")
       Set Cronograma = appProj.ActiveProject

       With ThisWorkbook.Sheets("Project")
          If UCase(Trim(Cronograma.name)) = UCase(Trim(.Cells(4, 2))) Then
             Resp = MsgBox("Plan OK" & vbNewLine & "Starting line: " & Cronograma.Tasks.Count + 1 & vbNewLine _
                             & "Continue?", vbQuestion + vbYesNo + vbDefaultButton1, "Generator")
             If Resp = vbYes Then
                Status 1
                Call Main
             End If
          Else
             'Nothing
          End If
       End With

 End Sub

足以使其在 Excel 2013 及更低版本下正常工作,但由于我不得不更改为 Excel 2016 (Office365),每次我使用项目对象时都会出现此错误,在这种情况下,当我尝试计算任务时:

Run-time error '-2147319779 (8002801d)':

Automation error Library not registered.

我已经尝试了我在 Internet 上找到的所有方法,例如旧密钥的注册表清理、注销和注册库、后期绑定项目对象等等。

有没有人找到解决这个问题的方法?

已经有一段时间了,但我终于找到了解决方法。

正如我在主要 post 上所说的,后期绑定不起作用,但经过一些测试后我不得不延迟 bing 代码中的所有其他对象并强制与合适的环境

像这样:

Dim appProj As Object
Dim Resp As Variant

   Set appProj = CreateObject("Msproject.Application.10")
   Set Cronograma = appProj.ActiveProject