word中怎样批量添加ABCD
发布网友
发布时间:2022-04-23 08:51
我来回答
共2个回答
热心网友
时间:2022-06-18 14:52
大神我来帮你解答!
打开此文档,按Alt+F11,打开宏代码编辑器,然后把如下代码原样复制粘贴进去,然后将光标至于代码中,按F5运行宏,10秒钟搞定几千道题。
这种东西需要用宏代码编程来实现的,并非Excel一定就能用得上或好用的。
Sub AddABCD()
Dim TableCount As Long
Dim Column As Integer
Dim Columns As Integer
Dim Rows As Long
Dim sels As String
TableCount = ActiveDocument.Tables.Count '获取文档中的表格数
Column = 4 '编号加在第4列,可以自行修改
For i = 1 To TableCount
Columns = ActiveDocument.Tables(i).Columns.Count
Rows = ActiveDocument.Tables(i).Rows.Count
If Column < 1 Then Column = 1
If Column > Columns Then Column = Columns
For r = 2 To Rows
ActiveDocument.Tables(i).Cell(r, Column).Select
If InStr(Trim(Selection.Text), vbCr) = InStrRev(Trim(Selection.Text), vbCr) Then GoTo NextR
With ListGalleries(wdNumberGallery).ListTemplates(4).ListLevels(1)
.NumberFormat = "%1."
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleUppercaseLetter
.NumberPosition = CentimetersToPoints(0)
.Alignment = wdListLevelAlignLeft
.TextPosition = CentimetersToPoints(0.74)
.TabPosition = CentimetersToPoints(0.74)
.ResetOnHigher = 0
.StartAt = 1
With .Font
.Bold = wdUndefined
.Italic = wdUndefined
.StrikeThrough = wdUndefined
.Subscript = wdUndefined
.Superscript = wdUndefined
.Shadow = wdUndefined
.Outline = wdUndefined
.Emboss = wdUndefined
.Engrave = wdUndefined
.AllCaps = wdUndefined
.Hidden = wdUndefined
.Underline = wdUndefined
.Color = wdUndefined
.Size = wdUndefined
.Animation = wdUndefined
.DoubleStrikeThrough = wdUndefined
.Name = ""
End With
.LinkedStyle = ""
End With
ListGalleries(wdNumberGallery).ListTemplates(4).Name = ""
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=ListGalleries( _
wdNumberGallery).ListTemplates(4), ContinuePreviousList:=False, ApplyTo:= _
wdListApplyToWholeList, DefaultListBehavior:=wdWord9ListBehavior
NextR:
Next
Next
MsgBox "处理完毕!" & vbcrlf & "更多批量处理实用功能,请参见《文件批量处理百宝箱V10.0》", vbInformation + vbOKOnly, "消息"End Sub
热心网友
时间:2022-06-18 14:53
你前面没有编辑好----也只有照图上来操作了!
追问我是想这一列的工作一个操作完成,有没有方法啊?你给的这个应该也是一个单元格一个单元个来操作吧?很麻烦啊…… 你说我前面没有编辑好,前面怎么编辑可以达到批量操作的效果?求解答~
追答你要是数据多的话可以复制到excel处理就方便了,在复制过来到wordok了