我需要将嵌入的Word文档从Excel保存到Windows%temp%文件夹。我当前的解决方案不起作用。错误在哪里?
Dim tempFolderPath As String
Dim filePath As String
Dim fileTitle As String
tempFolderPath = Environ("Temp")
fileTitle = ThisWorkbook.Sheets("Other Data").Range("AK2").Value & ", " & _
ThisWorkbook.Sheets("Other Data").Range("AK7").Value & "_" & _
ThisWorkbook.Sheets("Other Data").Range("AK8").Value & "_" & _
ThisWorkbook.Sheets("Other Data").Range("AU2").Value
objWord.SaveAs2 filePath = tempFolderPath & "\" & fileTitle & ".docx"
答案 0 :(得分:1)
SaveAs2
方法没有名为filePath
的属性。我认为您正在寻找FileName
。
尝试一下:
objWord.SaveAs2 FileName:= tempFolderPath & "\" & fileTitle & ".docx"
希望这会有所帮助!