在PowerPoint演示文稿中复制幻灯片

问题描述:

如何使用Excel VBA复制特定幻灯片?在PowerPoint演示文稿中复制幻灯片

+1

您可以发布你在你的编码工作,以复制幻灯片已经试过吗?如果您发布了您尝试过的代码以及您卡住的位置,我们可以帮助您:) –

在这里你去:

ActivePresentation.Slides(1).Duplicate 
+0

谢谢。完美工作 –

这将复制和移动滑轨1:

Sub Duplicate_And_Move_Slide() 

    Dim oPPT As Object 
    Dim oPresentation As Object 
    Dim oSlide As Object 

    Set oPPT = CreatePPT 
    Set oPresentation = oPPT.presentations.Open(_ 
     "<full path to your PP Presentation") 

    With oPresentation.slides(1) 
     .Duplicate 
     .MoveTo 3 
    End With 

End Sub 

'---------------------------------------------------------------------------------- 
' Procedure : CreatePPT 
' Purpose : Creates an instance of Powerpoint and passes the reference back. 
'----------------------------------------------------------------------------------- 
Public Function CreatePPT(Optional bVisible As Boolean = True) As Object 

    Dim oTmpPPT As Object 

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
    'Defer error trapping in case PowerPoint is not running. ' 
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
    On Error Resume Next 
    Set oTmpPPT = GetObject(, "PowerPoint.Application") 

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
    'If an error occurs then create an instance of PowerPoint. ' 
    'Reinstate error handling.         ' 
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
    If Err.Number <> 0 Then 
     Err.Clear 
     On Error GoTo ERROR_HANDLER 
     Set oTmpPPT = CreateObject("PowerPoint.Application") 
    End If 

    oTmpPPT.Visible = bVisible 
    Set CreatePPT = oTmpPPT 

    On Error GoTo 0 
    Exit Function 

ERROR_HANDLER: 
    Select Case Err.Number 

     Case Else 
      MsgBox "Error " & Err.Number & vbCr & _ 
       " (" & Err.Description & ") in procedure CreatePPT." 
      Err.Clear 
    End Select 

End Function 
+0

谢谢..它完美的为我工作 –