Sub SetColumnWidthAndRowHeight() Dim rng As Range ' 获取当前选择的单元格范围 Set rng = Selection ' 检查是否选择了单元格 If rng Is Nothing Then MsgBox "请先选择一个单元格区域。" Exit Sub End If rng.Columns.ColumnWidth = 20 ' 设置列宽为20 rng.Rows.RowHeight = 28 ' 设置行高为28 End Sub
Sub IncreaseLineSpacing() Dim para As Paragraph Dim increaseAmount As Single ' 设置每次增加的行间距量(以磅为单位) increaseAmount = 0.5 ' 例如,增加0.5磅 ' 检查是否有选定的文本 If Selection.Paragraphs.Count = 0 Then MsgBox "请先选择一个或多个段落。" Exit Sub End If ' 遍历选定的段落并增加行间距 For Each para In Selection.Paragraphs para.Format.LineSpacing = para.Format.LineSpacing + increaseAmount Next para End Sub