|
大大,能否帮我解决下,我是纯新人。。我需要把两个文件交替粘贴,但是遇到表格位置要出错,还有就是粘贴的时候怎么保留原文样式呢,希望帮忙解决下,万分感谢。跪谢!!!这些都是我在网上东拼西凑的,再次感谢。。
Sub 单语改双语()
Dim MyDialog As FileDialog, vrtSelectedItem As Variant, Doc As Document
Set MyDialog = Application.FileDialog(msoFileDialogFilePicker)
With MyDialog
.Title = "请选择要处理的文档(可多选)"
.Filters.Clear '清除所有文件筛选器中的项目
.Filters.Add "所有WORD 文件", "*.docx", 1 '增加筛选器的项目为所有WORD文件
.AllowMultiSelect = True '允许多项选择
If .Show = -1 Then '确定
For Each vrtSelectedItem In .SelectedItems '在所有选取项目中循环
Set Doc = Documents.Open(FileName:=vrtSelectedItem, Visible:=False)
单语改双语进程 Doc
Doc.Close
Next
End If
End With
End Sub
Sub 单语改双语进程(ByVal Doc As Document)
Dim n As Integer, cp As Paragraph
If MsgBox("此文件段落数:" & ActiveDocument.Paragraphs.Count & Chr(13) & "新打开的文件段落数:" & Doc.Paragraphs.Count & Chr(13) & Chr(13) & "请确认是否继续!", vbYesNo, "是否继续单语改双语") = vbNo Then
MsgBox "已取消!"
Exit Sub
End If
For n = Doc.Paragraphs.Count To 1 Step -1
On Error Resume Next
Set cp = Doc.Paragraphs(n)
Set ep = ActiveDocument.Paragraphs(n).Range
ep.InsertAfter Text:=cp.Range.Text
Next
End Sub
|
|