Hello! I wonder if someone can help me. I'm trying to create a Macro that would copy a line of text from one Word doc into a specific position of another Word doc, and then use the content of the clipboard as the Filename. From recording various Macros and researching on the internet, I've come to the Macro as below.
However, it shows an error 5487 - Word cannot complete the Save due to a file permission error. Although this bit had been previously reported on one of the forums as a working one. I'd be most greatful of comeone could advise.
Also, this is actually not an ideal solution for me as it requires having the target file Report Header to be open. I'd also like to make Word open it as a part of the Macro but failed to make this happen.
Thanks in anticipation,
Maria
Sub Macro3()
Selection.HomeKey Unit:=wdStory
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Cut
Windows("Report Header.doc").Activate
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.EndKey Unit:=wdLine
Selection.PasteAndFormat (wdPasteDefault)
ClipboardText = Selection
ActiveDocument.SaveAs FileName:=ClipboardText & ".doc", FileFormat:=wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
ActiveWindow.Close
End Sub