當前位置:編程學習大全網 - 編程語言 - word 用宏實現這個簡單操作..

word 用宏實現這個簡單操作..

宏的內容是這些的思路

查找:ctrl H,然後選右側的 定位。下面選 表格。這是基本的壹個創建循環的路子。只要能定位到表格了,就能通過表格菜單,給第壹列插入列(左側),而且這樣的插入只能通過菜單去插入,因為選擇↓的選擇第壹列在編輯宏的時候,不能用了。

======

詳細的說壹下步驟

光標放在文件最上面,工具→宏→錄制宏→指定快捷鍵,我用的ctrl L,然後回到word編輯宏的界面。

ctrl H,選右側的 定位(G),下面選表格,下壹個,這樣就進入了第壹個表格的第壹個單元格,單擊菜單上的 表格→插入→列(在左側),然後按壹下方向箭頭的下箭頭,使光標移出表格。結束宏錄制。

現在連續的執行宏快捷鍵,ctrl L,看著表格就自動的增加了壹列了。

到最後的時候,提示就不能用宏了。

詳細的宏代碼如下:(說真的我不會VB,看不懂這些代碼,但是,只要有思路了,就能用基本的word宏來操作,至於代碼,是專業人員研究的範疇)

========

Sub Macro4()

'

' Macro4 Macro

' 宏在 2010-1-19 由 大俠在線 錄制

'

Selection.GoTo What:=wdGoToTable, Which:=wdGoToNext, Count:=1, Name:=""

Selection.Find.ClearFormatting

Selection.Find.ParagraphFormat.TabStops.ClearAll

With Selection.Find.ParagraphFormat

With .Borders(wdBorderLeft)

.LineStyle = wdLineStyleSingle

.LineWidth = wdLineWidth075pt

.Color = wdColorAutomatic

End With

With .Borders(wdBorderRight)

.LineStyle = wdLineStyleSingle

.LineWidth = wdLineWidth075pt

.Color = wdColorAutomatic

End With

With .Borders(wdBorderTop)

.LineStyle = wdLineStyleSingle

.LineWidth = wdLineWidth075pt

.Color = wdColorAutomatic

End With

With .Borders(wdBorderBottom)

.LineStyle = wdLineStyleSingle

.LineWidth = wdLineWidth075pt

.Color = wdColorAutomatic

End With

With .Borders

.DistanceFromTop = 0

.DistanceFromLeft = 0

.DistanceFromBottom = 0

.DistanceFromRight = 0

.Shadow = False

End With

End With

Selection.Find.Replacement.ClearFormatting

Selection.Find.Replacement.ParagraphFormat.Borders.Shadow = False

With Selection.Find

.Text = "^g"

.Replacement.Text = ""

.Forward = True

.Wrap = wdFindContinue

.Format = True

.MatchCase = False

.MatchWholeWord = False

.MatchByte = True

.MatchWildcards = False

.MatchSoundsLike = False

.MatchAllWordForms = False

End With

Selection.InsertColumns

Selection.MoveDown Unit:=wdLine, Count:=1

End Sub

  • 上一篇:少兒編程教育對孩子有什麽好處
  • 下一篇:電氣信息類專業包括哪些專業?
  • copyright 2024編程學習大全網