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
====================================
Sub CopyPastePPT2Word()
Dim shp As Shape
Dim sld As Slide
Dim wdApp As Word.Application
Dim oDoc As Word.Document
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
Set oDoc = shp.OLEFormat.Object
oDoc.Select
Selection.Copy
With wdApp
.Selection.Paste
.Selection.TypeParagraph
End With
Set oDoc = Nothing
End If
End If
Next shp
Next sld
End Sub

Re: Embedded word tables in Powerpoint by Jean-Guy

Jean-Guy
Thu Apr 14 21:56:42 CDT 2005

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¢!

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org




Re: Embedded word tables in Powerpoint by John

John
Fri Apr 15 17:51:39 CDT 2005

Hi Jean,

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.

Can you please suggest how I may use a document/range object?

Also, the oDoc as a Word.Document, and set it to
PowerPoint.Shape.OLEFormat.Object is how I have seen this described in all
automation I've seen.

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¢!
>
> --
> Salut!
> _______________________________________
> Jean-Guy Marcil - Word MVP
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
>
>
>



Re: Embedded word tables in Powerpoint by Jean-Guy

Jean-Guy
Mon Apr 18 01:27:35 CDT 2005

John Svendsen was telling us:
John Svendsen nous racontait que :

> Hi Jean,
>
> 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.
>
> Can you please suggest how I may use a document/range object?
>

Set a range in the destination.

start loop
Set a range in the source. (PowerPoint Word object)
Collapse the destination range (Range.Collapse wdCollapseEnd).
Make the destination range = source range (Use the FormattedText
property).
next

Sorry I can't help more than that right now. I am working on a big project
an I am attempting to take two classes at the same time...

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org