我这里使用的是wps
开发工具 —》宏—》创建—》编辑代码
根据窗口调整表格
Sub FormAdjustment()
' getfilename Macro
'
'获取文件名
Dim FileName$
FileName = ActiveDocument.Name
'获取绝对路径
Dim pth$
pth = ActiveDocument.Path
'拼接
pth = pth & "\" & FileName
'
' FormAdjustment Macro
'
Dim oDoc As Document
Dim oTable As Table
Set oDoc = Documents.Open(pth) '指定文件路径
For Each oTable In oDoc.Tables
oTable.AutoFitBehavior (wdAutoFitWindow) '根据窗口调整内容
Next
MsgBox "完成!"
End Sub
注意wps每次打开记得 开发工具—》加载项—》选择相应的宏