Reputation: 2412
I need to save embedded Word document from Excel to Windows %temp% folder. My current solution is not working. Where is the mistake?
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"
Upvotes: 1
Views: 5786
Reputation: 761
SaveAs2
method doesn't have a property called filePath
. I think you're looking for FileName
.
Try this:
objWord.SaveAs2 FileName:= tempFolderPath & "\" & fileTitle & ".docx"
Hope this helps!
Upvotes: 1