找回密码
 加入
搜索
查看: 1550|回复: 2

[AU3基础] 【已解决】关于word操作,如何调整格式问题

[复制链接]
发表于 2016-6-29 13:37:10 | 显示全部楼层 |阅读模式
本帖最后由 种菜砍柴 于 2016-7-12 13:04 编辑

对于word,我不知道如何调整格式
比如把标题居中,加粗,字体加大等一系列操作

实在不知道如何操作word,求教各位大侠!!!
发表于 2016-6-29 13:48:27 | 显示全部楼层
回复 1# 种菜砍柴


網路搜尋  WORD VBA  網上有很多資料可以參考
发表于 2016-6-29 15:03:45 | 显示全部楼层
本帖最后由 kk_lee69 于 2016-6-29 15:05 编辑

回复 1# 种菜砍柴

像這樣的東西 先找出來後  改成 AU3 的語法就可以 操作 WORD

   

06


一些 Word VBA 常用的程式碼





一、基本

(1) 按 Enter 鍵:Selection.TypeParagraph

(2) 設定固定行距:
      Selection.ParagraphFormat.LineSpacingRule = wdLineSpaceExactly
      Selection.ParagraphFormat.LineSpacing = 18  (註:依個人需求修改)

(3) 分割表格:Selection.SplitTable

(4) 游標向上移5列:
     Selection.MoveUp Unit:=wdLine, Count:=5, Extend:=wdExtend

     游標向下移5列:
     Selection.MoveDown Unit:=wdLine, Count:=5, Extend:=wdExtend

(5) 設定字體大小:Selection.Font.Size = FontSize

(6) 在游標處加入文字:Selection.TypeText Text:=....

(7)


二、表格相關

(1) 選擇文件中第一個表格:ActiveDocument.Tables(1).Select

(2) 平均分配欄寬:Selection.Cells.DistributeWidth

(3) 移到表格左上方第一格:Selection.HomeKey Unit:=wdStory

(4) 複製文件中第一個表格的第1列,並貼在某處:
     ActiveDocument.Tables(1).Rows(1).Range.Copy
     Selection.Collapse Direction:=wdCollapseStart
     Selection.Paste

(5) 刪除文件中第一個表格第一列第1格(非刪除內容):
     ActiveDocument.Tables(1).Cell(1, 1).Delete  

(6) 取得文件中第一個表格之行數:
      ActiveDocument.Tables(1).Columns.Count

      取得文件中第一個表格之列數:
      ActiveDocument.Tables(1).Row.Count

(7) 在文件中第一個表格之第2列第1欄尾端插入文字:
      ActiveDocument.Tables(i).Cell(2, 1).Range..InsertAfter "插入文字"

(8) 將游標移至某個表格中的左上方格:
      ActiveDocument.Tables(i).Cell(1, 1).Select
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-19 14:07 , Processed in 0.075340 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表