使用Excel中的VBA粘贴到Powerpoint中

时间:2015-04-02 19:14:33

标签: excel vba excel-vba powerpoint screenshot

我正在尝试从我与Excel中的VBA连接的应用程序中捕获屏幕截图。我想截取屏幕截图并将其粘贴到PowerPoint中。但是,我希望在新幻灯片上拍摄每个屏幕。

Dim Pptapp As New PowerPoint.Application
Set pres = Pptapp.Presentations.Add
Dim slidev As PowerPoint.Slide
'(take Screenshot, Don't need code help here)

'need help creating new slide
'need help pasting screenshot on new slide

'I want this to be able to loop through the below items

do until (the end of time)   
    Screenshot    
    new slide    
    paste on new slide     
loop

Dim Pptapp As New PowerPoint.Application
Set pres = Pptapp.Presentations.Add
Dim slidev As PowerPoint.Slide
PrintTheScreen ' function added else where 
Set slidev = pres.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutBlank)
slidev.Select
PasteTheScreen ' function added else where 

我需要执行.Select功能以确保幻灯片获得粘贴。

1 个答案:

答案 0 :(得分:2)

Dim Pptapp As New PowerPoint.Application
Set pres = Pptapp.Presentations.Add
Dim slidev As PowerPoint.Slide
PrintTheScreen ' function added else where 
Set slidev = pres.Slides.Add(1, PowerPoint.PpSlideLayout.ppLayoutBlank)
slidev.Select
PasteTheScreen ' function added else where 

我需要执行.select功能以确保幻灯片正在获取粘贴。