PDA

View Full Version : Solved: How to save OLE object added in a sheet.



rahul_g
03-30-2007, 03:19 AM
Hi All,

Can anyone please tell how to save the OLE objects added in a sheet.

Ex.
In a sheet i have added 100 MS word objects.(Embedded)
now i want to save all these 100 MS word objects into my d: drive as a word documents.

Can we write a macro for this.
i tried a lot but was not able to get the solution.
Any suggestion would be of great use.

Thanks in advance.

stanl
03-30-2007, 03:49 AM
Probably not the answer you want, but it is rare that word is embedded into Excel, usually it is the other way around, or you have Word embedded into Access. I have heard that embedding word into Excel only permits you to see the first page. My only guess is that you could open an ADODB.Stream and copy each Word Object to a file. Perhaps you could post a sample, with just a single embedded Word doc. Stan:dunno

rahul_g
03-31-2007, 07:59 AM
thanks for reply..
i got the solution..
following code can be used...



Sub save_ole_file()
Dim wordObj As OLEObject
Set wordObj = Worksheets("Sheet1").OLEObjects(1)

wordObj.Activate
With wordObj.Object.Application.WordBasic
.FileSaveas "c:\mytempx"
End With
End Sub