(Jean-Guy MArcil) Embedded word tables in PPT

J

John Svendsen

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
 
H

Howard Kaikow

you have to use

activedocument.undoclear

or some document object with undoclear.
 
J

John Svendsen

Hi Howard, thanks os much for helping.

I have ".ActiveDocument.UndoClear" in my code below - maybe in the wrong
place?

Again, thanks! JS
 
H

Howard Kaikow

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.
 

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