';自动化错误库未注册';使用Project 2010运行Excel 2016 VBA时
我什么都试过了,但没有成功 这是我的代码的开始:';自动化错误库未注册';使用Project 2010运行Excel 2016 VBA时,vba,excel,registry,ms-project,Vba,Excel,Registry,Ms Project,我什么都试过了,但没有成功 这是我的代码的开始: Public Sub Connect() Dim appProj As MSProject.Application Dim Resp As Variant Set appProj = CreateObject("Msproject.Application") Set Cronograma = appProj.ActiveProject With ThisWorkbook.Sheet
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),因此每次使用项目对象时都会显示此错误,在本例中,当我尝试计数任务时:
运行时错误'-2147319779(8002801d)':
未注册自动化错误库
我已经尝试了在internet上找到的所有方法,如旧密钥的注册表清理、注销和注册库、延迟绑定项目对象等等
有人找到了解决方法吗?已经有一段时间了,但我终于找到了解决方法 正如我在主要文章中所说的,后期绑定不起作用,但在一些测试之后,我不得不推迟bing代码上的所有其他对象,并强制与正确的环境关联 像这样:
Dim appProj As Object
Dim Resp As Variant
Set appProj = CreateObject("Msproject.Application.10")
Set Cronograma = appProj.ActiveProject