Dim s,s1 As String
s1 = Tables("表A").GetColVisibleWidth()
For Each dc As Col In Tables("表A").Cols
If DataTables("表A").Compute("count(" & dc.name & ")",dc.name &" Is Not Null") > 0
s = s & "|" & dc.name & "|" & dc.Width
End If
Next
Tables("表A").SetColVisibleWidth(s.Trim("|"))
原来的输出代码
Tables("表A").SetColVisibleWidth(s1)