excel - VBA 库未注册运行时错误“-2147319779 (8002801d)”
问题描述
`我目前使用以下 VBA 来创建我的季度报告。
'Dim ppApp As PowerPoint.Application
Dim ppSlide As PowerPoint.Slide
Dim shp As Object
Dim myTextBox As Object
Dim PPTTitle As String
Dim PPTFooter As String
Dim i As Integer
Dim q As Integer
Dim ChrtstoCopy As Integer
Dim TblstoCopy As Integer
Dim Firstslide As Boolean
Dim CurrentSite As String
Dim shortDeptName As String
Sub CopytoPPT(Lbox_Exp, Lbox_Lis, Lbox_Rec)
'ACTIVATED BY: Userform2 Command Button
'PURPOSE: Copy the printareas for slides 1-5 in picture format and then
paste to a PPT slide.
'Identify the criteria for the PPT slides
CurrentSite = UserForm2.SiteTbox.Value
ChrtstoCopy = Slide1_Sht.Range("S19").Value - 1
TblstoCopy = Slide5_Sht.Range("D5").Value
Firstslide = True
If UserForm2.CheckBox1 = True Then
blinded = " (Blinded)"
Else
blinded = " (Unblinded)"
End If
shortDeptName =
TgtSht.Range("SaveFileName").Find(What:=CurrentSite).Offset(0, 1).Text
fileNameString = TgtSht.Range("SaveFolder") & TgtSht.Range("SavePrefix") &
" - " & shortDeptName
'Open PPT application and existing blank PPT template file
Set ppApp = New PowerPoint.Application
ppApp.Visible = True
VBA 用于将我的数据粘贴到 power point 中呈现的图表中。最近我的桌面更新为 64 位,当我尝试运行我的 VBA 来生成我需要的电源点时,它给了我以下错误消息。运行时错误“-2147319779 (8002801d)”:自动化错误库未注册
我试图进一步调查可能导致此问题的原因,我认为这可能与命令“Set ppApp = New PowerPoint.Application”有关。
当我尝试只为 PasteImgtoPPT 运行宏时,我收到运行时错误“91”:对象变量或块变量未设置错误。
我已经尝试了数周来修复这个 VBA,但似乎找不到解决方案。任何帮助将不胜感激!
解决方案
很可能您在项目中没有Microsoft Powerpoint
引用,因此尝试声明引用 powerpoint 的变量将失败(您的项目不知道那是什么)。
要告诉你的项目(做参考)去工具>>参考并在列表中找到它:
检查它,然后单击“确定”,然后尝试再次执行您的 VBA。
您还可以考虑后期绑定您的 powerpoint 变量,这样您就不必引用它们:
Dim ppApp As Object
Dim ppSlide As Object
Set PPApp = CreateObject("PowerPoint.Application")
Set ppSlide = PPApp.Slide
CreateObject
Powerpoint.Application
在运行时加载对的引用。
推荐阅读
- rust - 生命周期参数和函数指针的问题
- amazon-web-services - Auth.changePassword 抛出“不正确的用户名或密码”
- jquery - 用正则表达式替换字符串中的多个字符(寻求改进)
- r - dcast 从宽到长
- java - Kerberos 和纱线节点管理器无法连接资源管理器。未能指定服务器的 Kerberos 主体名称
- lua - Lua 3d 表缺乏对象持久性(键值与表数据不一致)
- db2 - UnicodeDecodeError:“utf-16-le”编解码器无法解码位置 10-11 中的字节:非法编码
- azure-devops - 当我的 Azure DevOps 构建管道运行时,我只想创建一个新的 nuget 包版本 - 如果解决方案的项目代码已更改。如何?
- php - 如何在 wordpress 主页上加载 Bootstrap **仅限**
- python - 让不和谐的机器人在语音频道上说些什么