4

私の問題は、グラフをに貼り付けて、埋め込まれたリンクを Excel-VBA 経由で更新しようとしていることです。

以下のコードを試してみましたが、失敗しました:

コード 1

    AppPPT.Presentations.Open "D:\Demo.pptx", Untitled:=msoTrue
    AppPPT.ActivePresentation.UpdateLinks
    AppPPT.ActivePresentation.SaveAs "D:\Demo.pptx"

コード 2

    For i = 1 To AppPPT.ActivePresentation.Slides.Count
    For s = 1 To AppPPT.ActivePresentation.Slides(i).Shapes.Count
        If AppPPT.ActivePresentation.Slides(i).Shapes(s).Type = msoLinkedOLEObject Then
            AppPPT.ActivePresentation.Slides(i).Shapes(s).LinkFormat.Update
        End If
    Next s
Next i

コード 3

    Set PPTTemplate = AppPPT.Presentations.Open("D:\Demo.pptx")

    ' update chart
    Dim osld As Slide
    Dim oshp As PowerPoint.Shape

    For Each osld In PPTTemplate.Slides
    For Each oshp In osld.Shapes
    With oshp
    If .HasChart Then
    .Chart.ChartData.Activate
    .Chart.ChartData.Workbook.Close
    .Chart.Refresh
    End If
    End With
    Next oshp
    Next osld

    AppPPT.Activate
4

2 に答える 2

5

私はそれを試して数日を費やしてそれを達成しました

AppPPT.ActivePresentation.Slides(1).Shapes("Chart 75").LinkFormat.Update

および BreakLines コード

AppPPT.ActivePresentation.Slides(1).Shapes("Chart 75").LinkFormat.BreakLink
于 2013-02-27T10:07:07.243 に答える