I've written a macro in an Excel file that opens an external Dord document (external.docx) and copies the contents (so they can be pasted into a new word file, along with data from the Excel file).
Instead of having an external Word file, I'd like to have the Word document as an embedded object in the main Excel file. The problem is I don't know how to get the macro to copy from an embedded file instead of an external one.
Currently, the segment of code that opens the document and copies the contents is this:
Dim appWrdExt As Object
Dim ExtDoc As Object
Set appWrdExt = CreateObject("Word.Application")
Set ExtDoc = appWrdH.Documents.Open("C:\external.docx") ' This is the line I think I need to modify
appWrdExt.Selection.WholeStory
appWrdExt.Selection.Copy
I created an embedded object from the external word document. If I record a macro, and open the object, it generates this code:
ActiveSheet.Shapes("Object 375").Select
Selection.Verb Verb:=xlOpen
How do I reconcile that with my existing macro so that I can copy the contents from the embedded document?