我有点坚持这段代码
我需要一个powerpoint宏,它允许我将所有powerpoint文件保存到名为“presentation of presentation”+ variable的特定地图。有人知道下面的代码有什么问题吗?
Sub save()
Dim i As Integer
Dim pptcount As Integer
Dim pres As Presentation
Dim var1 As String
Set pres = Application.Presentations(i)
var1 = InputBox("geef hier je maand aan")
pptcount = Application.Presentations.Count
For i = 1 To pptcount
Application.ActivePresentation.SaveAs "X:\SSC_HR\SENS\Bedrijfsbureau\Rapportages\SENS referenten rapportage\Template_Uploaden\" & var1 & ".ppt"
Next
End Sub
答案 0 :(得分:1)
试试这段代码:
Sub save()
Dim pres As Presentation
Dim var1 As String
var1 = InputBox("geef hier je maand aan")
If var1 <> "" Then
For Each pres In Application.Presentations
pres.SaveAs "X:\SSC_HR\SENS\Bedrijfsbureau\Rapportages\SENS referenten rapportage\Template_Uploaden\" & Split(pres.Name, ".")(0) & var1 & ".ppt"
Next
End If
End Sub