Option explicitpublic filenames as variantpublic savename as variantpublic pptapp as objectsub getfiles () filenames = application. getopenfilename _ (filefilter: = "Presentation (*. PPT ),*. ppt ", filterindex: = 1, _ multiselect: = true, Title: =" open the file to be merged ") end subsub savefileas () savename = application. getsaveasfilename (initialfilename: = "document merging result", _ filefilter: = "Presentation (*. PPT ),*. ppt ", filterindex: = 1, _ title: =" Save the results of the combination of Documents ") End subsub Merge () dim pre as object dim I as double dim N as double err. clear on error resume next set pptapp = Createobject ("PowerPoint. application ") pptapp. displayalerts = false on error goto 0 if err. number <> 0 then beep msgbox "error, the system does not install MS PowerPoint", vbokonly, "merge presentation" pptapp. quit application. quit end if err. clear on error resume next set pre = pptapp. presentations. add for I = lbound (File Names) to ubound (filenames) doevents n = pre. slides. count pre. slides. insertfromfile index: = N, filename: = filenames (I) userform1.label. caption = "merging presentations... "& I &" completed! "Next on error goto 0 if err. Number <> 0 then beep msgbox" Unknown error! Exit? ", Vbokonly," merged presentation "pptapp. Quit application. Quit end if pre. saveas (savename) pptapp. displayalerts = true pptapp. Quit userform1.label. Caption =" the presentation has been merged! "Userform1.cmdquit. Caption =" OK (q) "End sub