-
SaveAs with embedded Word document - OLEObjects
Hi,
I have a Word Document embedded as OLEObject in an Excel sheet. What I want to do is to store this embedded object as a file on the disc using VBA.
I use the following code to access and store the embedded object:
[VBA]
Dim oleObject As Object
Dim wordDocument As Object
Set oleObject = ActiveWorkbook.Sheets(sheetName).OLEObjects(1)
Set wordDocument = oleObject.Object
wordDocument.SaveAs ("some filename")
[/VBA]
The previous code works well if double-click the embedded OLE object, thus get the focus, and then deactivate it by clicking on the Excel sheet. However, after a re-start of Excel, it doesn't work, so I have to double-click the object and then click on the sheet again in order to get it work. Otherwise I get a runtime error.
I also tried to .Activate and set the .Verb property, with no success. Anybody has a solution for that?
Thanks,
Christoph
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules