Reputation: 1
So I had this code in Excel VBA:
Dim oWord As New Word.Application
Dim objDoc
Set objDoc = oWord.Documents.Open("C:\folder\document.docx")
But now instead of having document.docx as an external Word document I embedded it on a sheet as an object (Object 1). Therefore, I want to edit the code above to access the object instead of the external file.
In other words I want the code to be something like this:
'Set objDoc = oWord.Documents.Open(Object 1)
I have seen the question here, but I want the line of code above and it doesn't explain how to do it.
Thanks
Upvotes: 0
Views: 125
Reputation: 1
What I did eventually was use .SaveAs
to "export" the embedded document in a certain location, then run my code using the exported document and delete it in the end.
This works for the purpose of my code.
Upvotes: 0