以下是引用wuzhuo007ren在2007-1-3 16:08:03的发言:可每章也很大啊,那样也很费时啊,来不急了!!! 打开“中文.doc"和“英文.doc”文档,把下列代码粘贴于“中文.doc”的ThisDocument代码窗口中,运行即可: Sub MergeChinese_English() Dim c_Doc As Document, e_Doc As Document Dim i As Paragraph, n As Integer, myRange As Range Dim thatRange As Range, newRange As Range On Error GoTo ErrHandle Application.ScreenUpdating = False Set c_Doc = Documents("中文.doc") Set e_Doc = Documents("英文.doc") Set newRange = c_Doc.Content GN: For Each i In newRange.Paragraphs n = n + 1 Set myRange = i.Range Set thatRange = e_Doc.Content.Paragraphs(n).Range With myRange If VBA.InStr(i.Style, "标题 3") <> 0 Then .SetRange .End - 1, .End - 1 thatRange.SetRange thatRange.Start, thatRange.End - 1 .InsertAfter thatRange.Text Else .InsertAfter thatRange .Paragraphs(2).Style = .Paragraphs(1).Style .Paragraphs(2).Range.ListFormat.RemoveNumbers .Paragraphs(2).LeftIndent = .Paragraphs(1).LeftIndent newRange.SetRange myRange.End, c_Doc.Content.End - 1 GoTo GN End If End With Next ErrHandle: Application.ScreenUpdating = True End Sub
附代码:
6tPruc4v.rar
(9.46 KB, 下载次数: 17)
[此贴子已经被作者于2007-1-3 17:14:42编辑过] |