Hi Jean-Guy,
Thanks for your reply.
I am running Powerpoint/Word 2000 SR-1 on Windows 2000 Professional. The PPt
files are from 100 to 300 slides with about 1 word embedded table in each
slide.
I've tried to put the .UndoClear in the code, but it seems that wherever I
put it the compiler complains. Also added Save command.
Can you please suggest how I may use a document/range object?
Also, "oDoc as Word.Document", and " set to
PowerPoint.Shape.OLEFormat.Object" as I have seen this described in all
automation example codes I've found.
Sub CopyPastePPT2Word()
Dim shp As Shape
Dim sld As Slide
Dim wdApp As Word.Application
Dim oDoc As Word.Document
Dim SldNum As Long
Set wdApp = New Word.Application
With wdApp
.Documents.Add
.Visible = True
End With
For Each sld In Application.ActivePresentation.Slides
For Each shp In sld.Shapes
If shp.Type = msoEmbeddedOLEObject Then
If shp.OLEFormat.ProgID = "Word.Document.8" Then
'Get the current slide number
SldNum = ActiveWindow.Selection.SlideRange.SlideNumber
Set oDoc = Nothing
Set oDoc = shp.OLEFormat.Object
oDoc.Select
Selection.Copy
With wdApp
.Selection.Paste
.Selection.TypeParagraph
.ActiveDocument.UndoClear
End With
Set oDoc = Nothing
End If
End If
Next shp
Next sld
End Sub
Again, thanks for your help.
Regards, JS
"Jean-Guy Marcil" <no-spam@leaveme.alone> wrote in message
news:%23WrwCbWQFHA.4020@tk2msftngp13.phx.gbl...
> John Svendsen was telling us:
> John Svendsen nous racontait que :
>
> > Hi there, I have a macro that copies embedded word tables in PPT to a
> > WORD document, but with large PPT files I get a Word error
> > "Insufficient Memory or Disk space. Close extra windows and save your
> > work", but I have a lot of RAM and disk space. Also, if I try to
> > debug VBA, the 'Set oDoc = shp.OLEFormat.Object' becomes yellow.
> > Does anybody have a clue what's going on here? something I
> > forgot to clean-up in the code? Thanks so much! JS
>
> How large?
> What Office version?
>
> Have you tried with a .UndoClear after each pasting operation?
>
> Why don't you use a document/range object instead of wdApp.Selection? It
> might run faster and more reliably.
>
> Finally, not having really the time to look into this any deeper right
now,
> just a thought:
> You declare oDoc as a Word.Document, but you set it to a
> PowerPoint.Shape.OLEFormat.Object, is that OK (Just curious really, having
> never done it myself. I have done this sort of thing, but I was copying
> whole slides to Word, not just some shapes based on type...)
>
> Just my 2?!
Howard Kaikow - 17 Apr 2005 18:04 GMT
you have to use
activedocument.undoclear
or some document object with undoclear.

Signature
http://www.standards.com/; See Howard Kaikow's web site.
> Hi Jean-Guy,
>
[quoted text clipped - 78 lines]
> >
> > Just my 2¢!
John Svendsen - 17 Apr 2005 18:12 GMT
Hi Howard, thanks os much for helping.
I have ".ActiveDocument.UndoClear" in my code below - maybe in the wrong
place?
Again, thanks! JS
> you have to use
>
[quoted text clipped - 85 lines]
> > >
> > > Just my 2¢!
Howard Kaikow - 17 Apr 2005 18:49 GMT
the first thing i would try with your code would be to use the range object
instead if the selection object.
not sure whether this affects the undo stack any differently, but it will
reduce the drain on word's resources by not causing the screen to be diddled
with,
if using the range object doesn't eliminate the problem, then i'd add an
undoclear after each selection/range action.

Signature
http://www.standards.com/; See Howard Kaikow's web site.
> Hi Howard, thanks os much for helping.
>
[quoted text clipped - 98 lines]
> > > >
> > > > Just my 2¢!