我正在尝试使用阿拉伯语(unicode)名称打开一个包含所有powerpoint文件的文件夹并编辑它们,然后我了解VBA并找到此代码here
然而,当我尝试使用它时,它并没有打开文件,并且始终伴随并且错误地打开'功能
我也尝试过这个解决方案here - StrConv函数 - 但它似乎也没有用。
这是我的最终代码
Sub BatchSave()
' Opens each PPT in the target folder and saves as PPT97-2003 format
Dim sFolder As String
Dim sPresentationName As String
Dim oPresentation As Presentation
' Get the foldername:
'sFolder = InputBox("Folder containing PPT files to process", "Folder")
sFolder = "E:\taranem\tttt\tranem"
If sFolder = "" Then
Exit Sub
End If
' Make sure the folder name has a trailing backslash
If Right$(sFolder, 1) <> "\" Then
sFolder = sFolder & "\"
End If
' Are there PPT files there?
If Len(Dir$(sFolder & "*.PPT")) = 0 Then
MsgBox "Bad folder name or no PPT files in folder."
Exit Sub
End If
' Open and save the presentations
sPresentationName = Dir$(sFolder & "*.ppt")
While sPresentationName <> ""
f = sFolder & StrConv(sPresentationName, vbFromUnicode)
Set oPresentation = Presentations.Open(f, , , False)
Call oPresentation.SaveAs(sFolder & "N_" & sPresentationName, ppSaveAsShow)
oPresentation.Close
' New presentation is now saved as N_originalname.ppt
' Now let's rename them - comment out the next couple lines
' if you don't want to do this
' Original.PPT to Original.PPT.OLD
Name sFolder & sPresentationName As sFolder & sPresentationName & ".OLD"
' N_Original.PPT to Original.PPT
Name sFolder & "N_" & sPresentationName As sFolder & sPresentationName
sPresentationName = Dir$()
Wend
MsgBox "DONE"
End Sub
错过了缩进我知道xD