VB.net 中的 powerpoint365 自动化

问题描述 投票:0回答:1

该程序在Win10和Microsoft Office下运行良好。 现在我已经换成WIN 11和Office365了,还是不行。

尽管 导入 Microsoft.Office.Interop.PowerPoint” VB答案 类型“Microsoft.Office.Interop.PowerPoint.Application”未定义”。 .presentation + .slide 和 .slideshowsetting 也会发生同样的情况。

这是我的代码

Imports Microsoft.Office.Interop
Imports System.Runtime.InteropServices
Imports Microsoft.Office.Interop.PowerPoint
Imports Microsoft.Office.Interop.Excel


Public Class frmPowerpoint_Präsentation


    Public Shared PowerPointType As Type = Type.GetTypeFromProgID("PowerPoint.Application")
    Public Shared PowerPoint As Object = Activator.CreateInstance(PowerPointType)
    Public Shared objppApplication As New Microsoft.Office.Interop.PowerPoint.Application
    Public Shared objppPresentation As Microsoft.Office.Interop.PowerPoint.Presentation
    Private Shared objSlide As Microsoft.Office.Interop.PowerPoint.Slide
   
    Private objSettings As Microsoft.Office.Interop.PowerPoint.SlideShowSettings

   
   

我该如何解决这个问题

UPS

我已经尝试改变改变为

'// PowerPoint automation
Dim PowerPointType = Type.GetTypeFromProgID(\"PowerPoint.Application\")
Dim PowerPoint = Activator.CreateInstance(PowerPointType)
Dim oApp As New Microsoft.Office.Interop.PowerPoint.Application
Dim oPres As Microsoft.Office.Interop.PowerPoint.Presentation
Dim oSlide As PowerPoint.Slide

'// Open MS PowerPoint in a hidden window
oPres = oApp.Presentations.Open(ppt_filename,,,Microsoft.Office.Core.MsoTriState.msoFalse)

但效果不佳。

vb.net powerpoint
1个回答
0
投票

没有任何效果意味着我每次都会再次收到错误消息“'Microsoft.Office.Interop.PowerPoint.Application'未定义”。但是,我自己通过重新保存“Microsoft.Office.Interop.PowerPoint.Application”的引用路径以及项目文件夹中提到的其他引用找到了解决方案。
该项目设置为“anyCPU”。 感谢您的帮助。 UPS

© www.soinside.com 2019 - 2024. All rights reserved.