i'm looking for code to convert ppt slide to word.
the below code not working well
Code: Select all
Sub CopyText()
' for ms word
Dim wdApp As Word.Application, wdDoc As Word.Document
Set wdApp = GetObject(, "Word.Application")
If wdApp Is Nothing Then Set wdApp = New Word.Application
Set wdDoc = wdApp.ActiveDocument
Dim sld As Slide
Dim shp As Shape
Set sld = Application.ActiveWindow.View.Slide
Dim isTitle As Boolean
Dim showTitle As Boolean
For Each sld In ActivePresentation.Slides
isTitle = False
showTitle = True
For Each shp In sld.Shapes
If shp.HasTextFrame Then
If shp.TextFrame.HasText Then
If LastTitle = shp.TextFrame.TextRange.Text Then
showTitle = False
End If
shp.TextFrame.TextRange.Copy
If Not isTitle Then
If showTitle Then
wdApp.Selection.Style = wdDoc.Styles("Heading 1")
wdApp.Selection.PasteAndFormat wdPasteDefault
wdApp.Selection.Move
'wdApp.Selection.Paste
'wdApp.Selection.PasteSpecial DataType:=wdPasteText
LastTitle = shp.TextFrame.TextRange.Text
End If
isTitle = True
Else
wdApp.Selection.TypeParagraph
wdApp.Selection.PasteAndFormat wdPasteDefault
wdApp.Selection.Move
End If
End If
Else
shp.Copy
wdApp.Selection.PasteAndFormat wdPasteDefault
'wdApp.Selection.Paragraphs.Add
wdApp.Selection.Move
wdDoc.Content.InsertAfter (vbCrLf)
End If
Next shp
Next sld
End Sub
End Sub
susant