我是视觉基本脚本的新手.. 我试图使用以下.vbs代码将多个ppt文件合并到一个ppt中。 它应该从存储在名为PPTmerge的子文件夹中的所有ppts创建一个名为merged.ppt的新ppt。
但是在执行时我得到了错误:
Set out = Application.Presentations.Open(f)
有人可以帮助我......!
Const PPTMERGE_FILE = "Merged.ppt"
Const PPTMERGE_FOLDER = ".\PPTmerge"
Dim Application
Set Application=CreateObject("PowerPoint.Application")
Application.Visible = True 'must do this for merge to work
Dim first 'to open power point only once
first = True
Dim fs
Set fs=CreateObject("Scripting.FileSystemObject")
Dim folder
Set folder = fs.GetFolder(PPTMERGE_FOLDER)
Dim out
Dim f
Dim ff
For Each ff in folder.Files
f = PPTMERGE_FOLDER + "\" + ff.Name
If first Then
Dim p
Set out = Application.Presentations.Open(f)
out.SaveAs PPTMERGE_FOLDER + "\..\" + PPTMERGE_FILE
first = False
Else
out.Slides.InsertFromFile f, out.Slides.Count
End If
Next
If Not first Then
out.Save
out.SlideShowSettings.Run
'out.Close
End If
Set folder = Nothing
Set out = Nothing
Set folder = Nothing
'Application.Quit
Set Application = Nothing
答案 0 :(得分:0)
您尚未指定完整路径名。
Try const pptmerge_folder = "full path name here"
第2行的代码。