详细资料及下载文件见下面的连接:
加载宏 ppToWord.ppa(FOR OFFICE2000)
演示文件 pptToWord演示文稿1.ppt
效果:如果你的PP中的表格不多,主要是用文本框的话,基本可以完美的在WORD中再现!
欢迎大家一起探讨!
Public Sub 保留格式PP转换为WORD()
Call PowerPointToWord(True)
MsgBox "转换完毕 !(表格未做处理,请核对!)", vbInformation + vbOKOnly, "OK"
End Sub
Public Sub 删除格式PP转换为WORD()
Call PowerPointToWord(False)
MsgBox "转换完毕 !(表格未做处理,请核对!)", vbInformation + vbOKOnly, "OK"
End Sub
Private Sub PowerPointToWord(blStyle As Boolean)
'-------------------------------------------------------------------------
'作用:主要是把文本框、占位符、艺术字、图片、公式里面得内容转换到WORD里面。
'图表、WORD表格、组织结构图等 OLE、表格暂时处理不好,主要是位置处理不好
'保持格式: blStyle = False ,= True 删除格式
'那位处理得好,麻烦通知一下:'ok99999ok@126.com
'-------------------------------------------------------------------------
On Error Resume Next
Dim wdApp As Object
Dim mr As SlideRange
Dim tx As TextRange
Dim i As Integer
Dim iCount As Integer
Dim iCunCount As Integer
Dim iShapeType As Integer
Set wdApp = CreateObject("Word.Application")
wdApp.Visible = True
'wdApp.Application.ScreenUpdating = False '关闭屏幕刷新
wdApp.documents.Add
Set mySlides = ActivePresentation.Slides.Range
iCount = mySlides.Count
For i = 1 To iCount
DoEvents
ActiveWindow.View.GotoSlide Index:=i
iCunCount = ActiveWindow.Selection.SlideRange.Shapes.Count '
For j = 1 To iCunCount
ActiveWindow.Selection.SlideRange.Shapes(j).Select
iShapeType = ActiveWindow.Selection.SlideRange.Shapes(j).Type
'1--自选图形
'7---公式 、(图表、WORD表格、组织结构图等 OLE)
'17--文本框 19--表格 15--艺术字 14--占位符
'13---图片
' Debug.Print iShapeType
Select Case iShapeType
Case 1, 14, 17
Set tx = ActiveWindow.Selection.ShapeRange.TextFrame.TextRange
tx.Select
If tx.Text <> "" Then
'----------------------------------------------------------------------
If blStyle Then
'保持格式
ActiveWindow.Selection.Copy
ActiveWindow.Selection.Copy
wdApp.documents(1).Activate
wdApp.Selection.Paste
'----------------------------------------------------------------------
Else
'删除格式
wdApp.documents(1).Range.InsertAfter tx.Text
End If
End If
Case 7, 13, 15 '图片、公式
ActiveWindow.Selection.Copy
'wdApp.Documents(1).Activate
wdApp.Selection.Paste
Case 19 '表格不处理
' ActiveWindow.Selection.Copy
' wdApp.Activate
' wdApp.Selection.Paste
End Select
Next j
Next i
' wdApp.Application.ScreenUpdating = True
End Sub
llkTEHYS.rar
(32.21 KB, 下载次数: 194)
[此贴子已经被作者于2005-8-13 9:52:03编辑过] |