Hi All,hope all is well!
This is my first crack at MS Word VBA.
I'm trying to do a simple macro where I have document A word doc that's opened, and want to write a MS word VBA code that allows me to select any word file in a directory path and opens the file where I can copy the contents from that selected document that opened and paste into document A and closes the file that was selected and keeping document A open.
here is some of the code below:
I have the second part of instructions down on how to copy & paste, just need the 1st part on selecting a file & opening it from a folder
Sub Copy_Content()
''need code to to select file, than open file to select content on doc to paste into document a''
Selection.WholeStory
Selection.Copy
Documents("documenta.docx").Activate
Selection.EndKey wdStory
Selection.PasteAndFormat Type:=wdFormatOriginalFormatting
Documents("documentb.docx").Close
End Sub
This is my first crack at MS Word VBA.
I'm trying to do a simple macro where I have document A word doc that's opened, and want to write a MS word VBA code that allows me to select any word file in a directory path and opens the file where I can copy the contents from that selected document that opened and paste into document A and closes the file that was selected and keeping document A open.
here is some of the code below:
I have the second part of instructions down on how to copy & paste, just need the 1st part on selecting a file & opening it from a folder
Sub Copy_Content()
''need code to to select file, than open file to select content on doc to paste into document a''
Selection.WholeStory
Selection.Copy
Documents("documenta.docx").Activate
Selection.EndKey wdStory
Selection.PasteAndFormat Type:=wdFormatOriginalFormatting
Documents("documentb.docx").Close
End Sub