English 中文(简体)
Excel / PowerPoint - Rotating a 3D A. 遥感模型
原标题:Excel / PowerPoint - Rotating a 3D Model in a remote app

如果在我的Excel工作表格中添加一个3D模式,那么我可以使用代码轮换。

ActiveSheet.Shapes("modGrating").Model3D.IncrementRotationY 10

如果在PT中我有3D模式,那么我可以使用代码进行轮换。

ActivePresentation.Slides(1).Shapes("modGrating").Model3D.IncrementRotationY 10

然而,如果我试图在通过Excel开张的笔试节目中转播3D模式,那就错了。

Dim ppt As PowerPoint.Application
Dim prs As PowerPoint.Presentation
Set ppt = CreateObject("PowerPoint.Application")
With ppt
    .Visible = True
    .WindowState = ppWindowMaximized
    Set prs = Nothing
    On Error Resume Next
    Set prs = .Presentations.Open(ThisWorkbook.Path & "TestFile.pptm", msoFalse, msoTrue, msoTrue)
    On Error GoTo 0
    prs.Slides(1).Shapes("modGrating").Model3D.IncrementRotationY 10
    .Activate
End With
Set prs = Nothing
Set ppt = Nothing

错误是“一次性错误430:” “地图册不支持自动化,也不支持预期的接口”

我可以做任何其它事情,但我可以不使用3D模式。

Anyone familar with this issue? Is there any way around it?

我提出了两个例子,表明了这一问题。 假设我可以的话,我们不肯定会如何在此附上牙。

这在我的个人电脑和手提电脑上都失败了。 两者都使用最新版本的MS 365。

最佳回答
  • Prior to rotation, make sure to select the shape.
  • Use shp as a variant rather than PowerPoint.Shape to avoid the 430 error (the root cause is not certain).
Option Explicit
  Excel VBA code, Early binding PowerPoint 16.0
Public Sub Test3DinPPT()
    Dim ppt As PowerPoint.Application
    Dim prs As PowerPoint.Presentation
    Dim shp   As PowerPoint.Shape
    Set ppt = CreateObject("PowerPoint.Application")
     Set ppt = GetObject(, "PowerPoint.Application")
    With ppt
        .Visible = True
             .WindowState = ppWindowMaximized
        Set prs = .Presentations.Open("d:	empTestFile.pptx", msoFalse, msoTrue, msoTrue)
             Set prs = .ActivePresentation
        Set shp = prs.Slides(1).Shapes("modGrating")
             Set shp = prs.Slides(1).Shapes(1)
        shp.Select
        shp.Model3D.IncrementRotationY 50
             .Activate
    End With
    Set prs = Nothing
    Set ppt = Nothing
End Sub

问题回答

显然,我可以通过StackOverflow分享档案,因此,这里就是如何进行检验。

启用新的Excel 工作手册,并在桌面上作为Xlsm文件予以保存。

开放VBA IDE,并增加微软PowerPoint作为参考

在新的模块中添加以下代码:

Public Sub Test3DinPPT()

Dim ppt As PowerPoint.Application
Dim prs As PowerPoint.Presentation

Set ppt = CreateObject("PowerPoint.Application")

With ppt
    .Visible = True
    .WindowState = ppWindowMaximized
    Set prs = .Presentations.Open(ThisWorkbook.Path & "TestFile.pptx", msoFalse, msoTrue, msoTrue)
    prs.Slides(1).Shapes("modGrating").Model3D.IncrementRotationY 10
    .Activate
End With

Set prs = Nothing
Set ppt = Nothing

End sub

1. 开始新的Power Point演示,并清除滑坡的一切东西 1. 加上3D模式,任何人都会这样做,并称其为变迁。

Save the file as TestFile.pptx on the Robinson (or where You put the Excel file).

接近和退出的PT。

操作Excel代码。 它不应落空。

为了证明守则能够发挥作用,你可以增加3D。 The Model to the Excel worksheet, calls it modGating and conducted this procedure......

Public Sub RotateGrating()

ActiveSheet.Shapes("modGrating").Model3D.IncrementRotationY 10

End Sub

The shape will move a bit





相关问题
import of excel in SQL imports NULL lines

I have a stored procedure that imports differently formatted workbooks into a database table, does work on them then drops the table. Here is the populating query. SELECT IDENTITY(INT,1,1) AS ID ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Excel date to Unix timestamp

Does anyone know how to convert an Excel date to a correct Unix timestamp?

C# GemBox Excel Import Error

I am trying to import an excel file into a data table using GemBox and I keep getting this error: Invalid data value when extracting to DataTable at SourceRowIndex: 1, and SourceColumnIndex: 1. As ...

Importing from excel "applications" using SSIS

I am looking for any tips or resources on importing from excel into a SQL database, but specifically when the information is NOT in column and row format. I am currently doing some pre-development ...

热门标签