|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub TEST()
Dim wdApp As Word.Application, wdDoc As Word.Document
Dim i&, j&, strFileName$, strPath$
strPath = ThisWorkbook.Path & "\"
strFileName = strPath & "测试文档.docx"
If Dir(strFileName) = "" Then MsgBox "指定的文件不存在,请检查!", vbExclamation: Exit Sub
Set wdApp = New Word.Application
Set wdDoc = wdApp.documents.Open(strFileName)
With wdDoc
With .Tables(1)
For i = 1 To .Rows.Count
For j = 1 To .Columns.Count
With .Cell(i, j).Range.Borders(wdBorderDiagonalUp)
.LineStyle = Options.DefaultBorderLineStyle
.LineWidth = Options.DefaultBorderLineWidth
End With
Next j
Next i
End With
.Close True
End With
wdApp.Quit
Set wdApp = Nothing: Set wdDoc = Nothing
Beep
End Sub |
评分
-
1
查看全部评分
-
|