GeoffreyBernardo
Programmer
Hallo Guys,
In Word, I want to take the text in a textbox in the active document and use it as the filename for the active document by using the SaveAs method. Here is the code:
Sub Rename_ActiveDocument()
Dim NewFileName As String
NewFileName = ActiveDocument.Shapes("Text Box 2").TextFrame.TextRange.Text
ActiveDocument.SaveAs FileName:=NewFileName
End Sub
Unfortunately, I get an error message: Word cannot complete the save due to a file permission error.
But if I just type the new filename in directly, it saves the file.
ActiveDocument.SaveAs FileName:= "Yabadabadoo"
What seems to be the problemo?
Thanks.
In Word, I want to take the text in a textbox in the active document and use it as the filename for the active document by using the SaveAs method. Here is the code:
Sub Rename_ActiveDocument()
Dim NewFileName As String
NewFileName = ActiveDocument.Shapes("Text Box 2").TextFrame.TextRange.Text
ActiveDocument.SaveAs FileName:=NewFileName
End Sub
Unfortunately, I get an error message: Word cannot complete the save due to a file permission error.
But if I just type the new filename in directly, it saves the file.
ActiveDocument.SaveAs FileName:= "Yabadabadoo"
What seems to be the problemo?
Thanks.