更改VBA访问代码以合并Powerpoint演示文稿而不是Word文档

时间:2018-07-23 13:50:16

标签: vba access-vba ms-access-2010 powerpoint-vba

我有一些将多个Word文档组合在一起的代码,但是,我想对其进行更改以将PowerPoint演示文稿组合在一起。

我是编程的新手,努力寻找正确的部分来更改或使用正确的“ vocab”。

如果您可以提供帮助,那将非常有用。

我的代码是

'Code to merge selected documents together
Sub MergeDocs(strInFullNames() As String, strOutFullName As String, 
intNoOfFiles As Integer)
   Dim wdApp As word.Application
   Dim wdDoc As Word.Document
   Dim outDoc As Word.Document
   Dim w As Integer
   Dim bNewInstance As Boolean


'Try to use already running instance of Word
On Error Resume Next
    Set wdApp = GetObject(, "word.Application")
On Error GoTo 0

If wdApp Is Nothing Then
    Set wdApp = CreateObject("word.application")
    bNewInstance = True
End If

Set outDoc = wdApp.Documents.Add

'For w = 0 To UBound(strInFullNames)
    If w > 0 Then
 '       outDoc.Bookmarks("\EndOfDoc").Range.InsertBreak wdSectionBreakNextPage
  '  End If
   ' Set wdDoc = Documents.Open(strInFullNames(w))
   ' objSelection.PasteAndFormat
    'wdDoc.Range.Copy
     'wdDoc.Close wdDoNotSaveChanges
    'outDoc.Bookmarks("\EndOfDoc").Range.Paste
'Next w

outDoc.SaveAs strOutFullName



'only close Word application if instance created for this macro
If bNewInstance Then
    wdApp.Quit
End If

MsgBox“已创建Word文档” 结束

谢谢

0 个答案:

没有答案