Embedded word tables in Powerpoint

J

John Svendsen

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
 
J

Jean-Guy Marcil

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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
J

John Svendsen

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
 
J

Jean-Guy Marcil

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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top