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