2015-04-02 144 views
1

我試圖從我在Excel中使用VBA連接到的應用程序捕獲屏幕截圖。我想拍攝屏幕截圖並粘貼到Powerpoint中。不過,我希望每個屏幕都拍攝一張新幻燈片。在Excel中使用VBA粘貼到Powerpoint中

昏暗Pptapp作爲新PowerPoint.Application

設置PRES = Pptapp.Presentations.Add

昏暗slidev作爲PowerPoint.Slide

「(採取截圖,不需要這裏的代碼幫助)

「需要幫助建立新的幻燈片 」需要幫助的新的幻燈片粘貼截圖

我想要個通過以下項目

'

' 能夠循環

做,直到(結束時間)

截圖

新的幻燈片上新

貼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功能,以確保幻燈片得到粘貼。

+0

歡迎來到SO!請粘貼代碼嘗試,而不是一個非常廣泛的算法。代碼嘗試使SO用戶輸入的問題更有效。根據您的語句邏輯,您需要首先將幻燈片定義爲「對象」。假設「Powerpoint」是使用後期綁定創建的PowerPoint應用程序對象,使用'Powerpoint.Slides.Add'將幻燈片放入其中。使用相同的邏輯添加一個'形狀',你將鏈接到一個截圖顯然保存在你的偏好的某個目錄。 – 2015-04-02 20:39:05

+0

如何創建幻燈片作爲對象? – 2015-04-02 20:51:43

+0

昏暗的幻燈片作爲對象:設置幻燈片= powerpoint.slides.add?你是從excel vba執行此操作的權利 – 2015-04-02 21:28:26

回答

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功能,以確保幻燈片得到粘貼。

相關問題