国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網 會員登陸 & 注冊

wps 宏 自動排版

2023-10-28 15:00 作者:激仰的南瓜  | 我要投稿

Sub 自動程序()

? ? ' 設置頁面布局和格式

? ? With ActiveDocument.PageSetup

? ? ? ? .Orientation = wdOrientPortrait ' 設置為縱向頁面方向

? ? ? ? .TopMargin = CentimetersToPoints(2) ' 頂部頁邊距為2厘米

? ? ? ? .BottomMargin = CentimetersToPoints(2) ' 底部頁邊距為2厘米

? ? ? ? .LeftMargin = CentimetersToPoints(2) ' 左側頁邊距為2厘米

? ? ? ? .RightMargin = CentimetersToPoints(2) ' 右側頁邊距為2厘米

? ? End With

? ??

? ? ' 設置段落格式

? ? With ActiveDocument.Content.ParagraphFormat

? ? ? ? .Alignment = wdAlignParagraphJustify ' 對齊方式為兩端對齊

? ? ? ? .LineSpacingRule = wdLineSpace1pt5 ' 行間距為1.5倍

? ? ? ? .SpaceAfter = 0 ' 段后間距為0

? ? End With

? ??

? ? ' 設置字體和字號

? ? With ActiveDocument.Content.Font

? ? ? ? .Name = "宋體" ' 設置字體為宋體

? ? ? ? .Size = 12 ' 設置字號為12磅

? ? End With

? ??

? ? ' 執(zhí)行自動排版

? ? ActiveDocument.AutoFormat

? ??


MsgBox "宏指令執(zhí)行完成", vbInformation



End Sub


Sub 圖片排版()

? ? Dim shp As Shape

? ??

? ? ' 設置頁面布局和格式

? ? With ActiveDocument.PageSetup

? ? ? ? .Orientation = wdOrientPortrait ' 設置為縱向頁面方向

? ? ? ? .TopMargin = CentimetersToPoints(2) ' 頂部頁邊距為2厘米

? ? ? ? .BottomMargin = CentimetersToPoints(2) ' 底部頁邊距為2厘米

? ? ? ? .LeftMargin = CentimetersToPoints(2) ' 左側頁邊距為2厘米

? ? ? ? .RightMargin = CentimetersToPoints(2) ' 右側頁邊距為2厘米

? ? End With

? ??

? ? ' 設置段落格式

? ? With ActiveDocument.Content.ParagraphFormat

? ? ? ? .Alignment = wdAlignParagraphJustify ' 對齊方式為兩端對齊

? ? ? ? .LineSpacingRule = wdLineSpace1pt5 ' 行間距為1.5倍

? ? ? ? .SpaceAfter = 0 ' 段后間距為0

? ? End With

? ??

? ? ' 設置字體和字號

? ? With ActiveDocument.Content.Font

? ? ? ? .Name = "宋體" ' 設置字體為宋體

? ? ? ? .Size = 12 ' 設置字號為12磅

? ? End With

? ??

? ? ' 遍歷文檔中的每個形狀對象

? ? For Each shp In ActiveDocument.Shapes

? ? ? ? Select Case shp.Type

? ? ? ? ? ? Case msoTextBox ' 文本框對象

? ? ? ? ? ? ? ? ' 設置文本框的段落格式

? ? ? ? ? ? ? ? With shp.TextFrame.TextRange.ParagraphFormat

? ? ? ? ? ? ? ? ? ? .Alignment = wdAlignParagraphJustify ' 對齊方式為兩端對齊

? ? ? ? ? ? ? ? ? ? .LineSpacingRule = wdLineSpace1pt5 ' 行間距為1.5倍

? ? ? ? ? ? ? ? ? ? .SpaceAfter = 0 ' 段后間距為0

? ? ? ? ? ? ? ? End With

? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? ' 設置文本框的字體和字號

? ? ? ? ? ? ? ? With shp.TextFrame.TextRange.Font

? ? ? ? ? ? ? ? ? ? .Name = "宋體" ' 設置字體為宋體

? ? ? ? ? ? ? ? ? ? .Size = 12 ' 設置字號為12磅

? ? ? ? ? ? ? ? End With

? ? ? ? ? ??

? ? ? ? ? ? Case msoPicture ' 圖片對象

? ? ? ? ? ? ? ? ' 調整圖片的大小和位置

? ? ? ? ? ? ? ? shp.LockAspectRatio = msoFalse ' 可以調整寬高比

? ? ? ? ? ? ? ? shp.Width = CentimetersToPoints(10) ' 設置圖片寬度為10厘米

? ? ? ? ? ? ? ? shp.Height = CentimetersToPoints(10) ' 設置圖片高度為10厘米

? ? ? ? ? ? ? ? shp.Left = CentimetersToPoints(2) ' 設置圖片左側位置為2厘米

? ? ? ? ? ? ? ? shp.Top = CentimetersToPoints(2) ' 設置圖片頂部位置為2厘米

? ? ? ? End Select

? ? Next shp

? ??

? ? ' 執(zhí)行自動排版

? ? ActiveDocument.AutoFormat

? ??

? ? ' 顯示消息框

? ? MsgBox "自動排版已完成!", vbInformation

End Sub

下面其他都可以就是表格不ok



Sub AutoLayout()

? ? Dim shp As Shape

? ? Dim tbl As Table

? ??

? ? ' 解除頁面設置的鎖定

? ? ActiveDocument.Sections(1).PageSetup.SectionStart = wdSectionContinuous

? ??

? ? ' 設置頁面布局和格式

? ? With ActiveDocument.PageSetup

? ? ? ? .Orientation = wdOrientPortrait ' 設置為縱向頁面方向

? ? ? ? .TopMargin = CentimetersToPoints(2) ' 頂部頁邊距為2厘米

? ? ? ? .BottomMargin = CentimetersToPoints(2) ' 底部頁邊距為2厘米

? ? ? ? .LeftMargin = CentimetersToPoints(2) ' 左側頁邊距為2厘米

? ? ? ? .RightMargin = CentimetersToPoints(2) ' 右側頁邊距為2厘米

? ? End With

? ??

? ? ' 設置段落格式

? ? With ActiveDocument.Content.ParagraphFormat

? ? ? ? .Alignment = wdAlignParagraphJustify ' 對齊方式為兩端對齊

? ? ? ? .LineSpacingRule = wdLineSpace1pt5 ' 行間距為1.5倍

? ? ? ? .SpaceAfter = 0 ' 段后間距為0

? ? End With

? ??

? ? ' 設置字體和字號

? ? With ActiveDocument.Content.Font

? ? ? ? .Name = "宋體" ' 設置字體為宋體

? ? ? ? .Size = 12 ' 設置字號為12磅

? ? End With

? ??

? ? ' 遍歷文檔中的每個形狀對象

? ? For Each shp In ActiveDocument.Shapes

? ? ? ? Select Case shp.Type

? ? ? ? ? ? Case msoTextBox ' 文本框對象

? ? ? ? ? ? ? ? ' 設置文本框的段落格式

? ? ? ? ? ? ? ? With shp.TextFrame.TextRange.ParagraphFormat

? ? ? ? ? ? ? ? ? ? .Alignment = wdAlignParagraphJustify ' 對齊方式為兩端對齊

? ? ? ? ? ? ? ? ? ? .LineSpacingRule = wdLineSpace1pt5 ' 行間距為1.5倍

? ? ? ? ? ? ? ? ? ? .SpaceAfter = 0 ' 段后間距為0

? ? ? ? ? ? ? ? End With

? ? ? ? ? ? ? ??

? ? ? ? ? ? ? ? ' 設置文本框的字體和字號

? ? ? ? ? ? ? ? With shp.TextFrame.TextRange.Font

? ? ? ? ? ? ? ? ? ? .Name = "宋體" ' 設置字體為宋體

? ? ? ? ? ? ? ? ? ? .Size = 12 ' 設置字號為12磅

? ? ? ? ? ? ? ? End With

? ? ? ? ? ??

? ? ? ? ? ? Case msoPicture ' 圖片對象

? ? ? ? ? ? ? ? ' 調整圖片的大小和位置

? ? ? ? ? ? ? ? shp.LockAspectRatio = msoFalse ' 可以調整寬高比

? ? ? ? ? ? ? ? shp.Width = CentimetersToPoints(10) ' 設置圖片寬度為10厘米

? ? ? ? ? ? ? ? shp.Height = CentimetersToPoints(10) ' 設置圖片高度為10厘米

? ? ? ? ? ? ? ? shp.Left = CentimetersToPoints(2) ' 設置圖片左側位置為2厘米

? ? ? ? ? ? ? ? shp.Top = CentimetersToPoints(2) ' 設置圖片頂部位置為2厘米

? ? ? ? End Select

? ? Next shp

? ??

? ? ' 遍歷文檔中的每個表格對象

? ? For Each tbl In ActiveDocument.Tables

? ? ? ? ' 調整表格的寬度為頁面寬度

? ? ? ? tbl.PreferredWidthType = wdPreferredWidthPercent

? ? ? ? tbl.PreferredWidth = 100

? ? Next tbl

? ??

? ? ' 執(zhí)行自動排版

? ? ActiveDocument.AutoFormat

? ??

? ? ' 顯示消息框

? ? MsgBox "自動排版已完成!", vbInformation

End Sub

下面是刪除表格所有的表格的宏


以下是刪除 Word 文檔中所有表格的 WPS 宏示例:


```vba

Sub DeleteAllTables()

? ? Dim tbl As Object

? ??

? ? ' 確保當前文檔不是只讀模式

? ? If ActiveDocument.ReadOnly Then

? ? ? ? MsgBox "無法編輯只讀文檔。", vbExclamation

? ? ? ? Exit Sub

? ? End If

? ??

? ? ' 確認是否刪除所有表格

? ? If MsgBox("是否確定刪除文檔中的所有表格?", vbQuestion + vbYesNo) = vbNo Then

? ? ? ? Exit Sub

? ? End If

? ??

? ? ' 循環(huán)刪除所有表格

? ? For Each tbl In ActiveDocument.Tables

? ? ? ? tbl.Delete

? ? Next tbl

? ??

? ? ' 顯示消息框

? ? MsgBox "已成功刪除文檔中的所有表格。", vbInformation

End Sub

```


請按照以下步驟使用上述宏:


1. 打開你想要刪除表格的 Word 文檔。

2. 按下 `Alt+F11` 進入 VBA 編輯器。

3. 創(chuàng)建一個新的宏模塊,將以上代碼粘貼到模塊中。

4. 保存宏并關閉 VBA 編輯器。

5. 使用快捷鍵 `Alt+F8` 打開宏列表。

6. 選擇 `DeleteAllTables` 宏并點擊 "運行" 按鈕。

7. 宏將刪除文檔中的所有表格,并顯示一個消息框確認刪除結果。


請注意,在運行宏之前,請確保已經保存好文檔的備份,以防意外刪除了不希望刪除的內容。



wps 宏 自動排版的評論 (共 條)

分享到微博請遵守國家法律
台中县| 长岭县| 文安县| 涿州市| 双辽市| 上饶市| 宁南县| 隆回县| 九江县| 塔城市| 西藏| 甘德县| 青铜峡市| 尖扎县| 勐海县| 宣汉县| 西峡县| 上饶市| 措美县| 靖西县| 莱阳市| 武邑县| 临沧市| 卫辉市| 库伦旗| 丰都县| 肇源县| 吴堡县| 莱州市| 本溪| 察雅县| 莱芜市| 凉山| 莫力| 二手房| 阳江市| 南投县| 安国市| 垣曲县| 秭归县| 革吉县|