Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ms access 更改VBA访问代码以合并powerpoint演示文稿而不是word文档_Ms Access_Vba_Ms Access 2010_Powerpoint - Fatal编程技术网

Ms access 更改VBA访问代码以合并powerpoint演示文稿而不是word文档

Ms access 更改VBA访问代码以合并powerpoint演示文稿而不是word文档,ms-access,vba,ms-access-2010,powerpoint,Ms Access,Vba,Ms Access 2010,Powerpoint,我有一些将多个word文档组合在一起的代码,但是,我想将其修改为将powerpoint演示文稿组合在一起 我是编程新手,很难找到要更改的正确部分或要使用的正确“vocab” 如果你能帮忙,那真的很有用 我的代码是 'Code to merge selected documents together Sub MergeDocs(strInFullNames() As String, strOutFullName As String, intNoOfFiles As Integer) Dim

我有一些将多个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文档” 端接头


谢谢

您好,首先您必须打开“powerpoint.Application”而不是“word.Application”当然,因为这两项任务涉及不同的对象集——Word对象和PowerPoint对象——我认为从对Word文档执行一项任务的代码开始,并尝试将其转换为对演示文稿执行另一项任务的代码没有多大意义。取而代之的是,考虑问题本身的优点——如果你不得不用手来合并演示文稿,你会怎么做?1) 打开PowerPoint应用程序,2)打开目标演示文稿3)打开源演示文稿4)将幻灯片从源演示文稿复制到目标演示文稿5)保存目标演示文稿。下一步是。。。。。。找出每个步骤对应的代码。然后,如果您在某个特定步骤上遇到困难,并且您做了一些研究但没有成功,那么更适合询问StackOverflow,比如“如何从VBA打开PowerPoint应用程序?”。此外,StackOverflow不是一种代码编写服务。请尝试这样的PowerPoint合并,并返回您需要帮助解决的特定问题/错误。谢谢@ZevSpitz。即使只是帮助我解决问题,也有助于澄清我需要做什么,并使任务更容易。