kerrypnx
8/20/2018 - 5:43 AM

批量修改模板

Dim MyDialog As FileDialog, vrtSelectedItem As Variant, doc As Document
    Set MyDialog = Application.FileDialog(msoFileDialogFilePicker)
   
    
If MyDialog.Show = -1 Then
    Application.ScreenUpdating = False
    For Each vrtSelectedItem In MyDialog.SelectedItems
    Set doc = Documents.Open(filename:=vrtSelectedItem, Visible:=True)
    With doc
    With Selection.Find
  .Text = "Table 1."
  .Font.Bold = True
  .MatchCase = True
  .Execute
  If .Found Then
    Selection.MoveDown wdParagraph, 1
    Selection.Tables(1).Select
    Selection.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle
  End If
End With
    
    
    .Close True
    End With
   
    Next
    Application.ScreenUpdating = True
    End If
    
    MsgBox "格式化文档操作设置完毕!", vbInformation