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:
[vba]
Sub Rename_ActiveDocument()
Dim NewFileName As String
NewFileName = ActiveDocument.Shapes("Text Box 2").TextFrame.TextRange.Text
ActiveDocument.SaveAs FileName:=NewFileName
End Sub
[/vba]
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.
[vba]ActiveDocument.SaveAs FileName:= "Yabadabadoo"[/vba]
What seems to be the problemo?
Thanks.