Word VBA 批量替换字体颜色

Word VBA 批量替换字体颜色

Sub 批量替换字体颜色()With ActiveDocument.Content.Find.ClearFormatting.Font.Color = wdColorRedWith .Replacement.ClearFormatting .Font.Color = wdColorBlack End With.Execute FindText:="", ReplaceWith:="", Format:=True, Replace:=wdReplaceAllEnd WithEnd Sub

VBA 2019-09-26 PM 6283℃ 0条
word vba 设置字体

word vba 设置字体

Sub 设置字体()Selection.GoTo What:=wdGoToLine, Which:=wdGoToFirst, Count:=1, Name:="" Selection.EndKey Unit:=wdLine, Extend:=wdExtend With Selection.Font .ColorIndex = 6 .Size = 15 .Name = "楷体_GB2312" End With End Sub

VBA 2019-09-25 PM 4574℃ 0条
word中使用vba实现:删除某两行之间的全部内容

word中使用vba实现:删除某两行之间的全部内容

如何在word中使用vba实现:删除某两行之间的全部内容比如有一篇文章,我已知“内容简介”在第1页的第15行,“作者简介”在第2页的第3行,我想删除这两行之间的所有内容,如何用vba实现?Word VBA 参考代码:Sub DeleteContent()Dim lngNumOfPages As Long lngNumOfPages = Selection.Information(wdNumberOfPagesInDocument) ' /* 确保文档至少有两页. */ If lngNumOfPages > 1 Then Dim lngStart As Long...

VBA 2019-09-25 PM 4785℃ 0条
VBA实现多列数据合并为一列

VBA实现多列数据合并为一列

经常会遇到将一个表格进行重新排列,实现把很多列的数据合并为一列,因此使用VBA实现多列数据合并为一列的功能,这一功能在日常工作也经常会用到,提供的这一VBA函数为MultiColumnsToOneColumn,具体源代码如下:Option Explicit'================================' 多列数据合并为一列' MultiColumnsToOneColumn''================================Sub MultiColumnsToOneColumn()Dim shtNew As WorksheetDim rngSelecti...

VBA 2019-09-25 PM 6593℃ 0条
VBA对Word行、段落和光标位置的移动、选择和操作

VBA对Word行、段落和光标位置的移动、选择和操作

Const wdCharacter = 1Const wdExtent = 1Const wdExtend = 1Const wdGoToBookmark = -1Const wdLine = 5Const wdCell = 12Const wdTableFormatSimple2 = 2Const wdAlignParagraphRight = 2Const wdYellow = 7Const wdToggle = 9999998Const wdAlignParagraphCenter = 1Const wdSentence = 3Const wdParagraph = 4Const ...

VBA 2019-09-25 PM 8075℃ 0条
Word文档中行数的VBA例程

Word文档中行数的VBA例程

一个统计Word文档中行数的VBA例程Sub test() Dim i As Integer Dim t As Table i = ActiveDocument.range.ComputeStatistics(wdStatisticLines) For Each t In ActiveDocument.Tables i = i - t.range.ComputeStatistics(wdStatisticLines) Next MsgBox iEnd Sub

VBA 2019-09-25 PM 3306℃ 0条
word vba 删除空白段落

word vba 删除空白段落

删除空白段落 '功能简介:可以对指定长度的段落进行删除,当LEN=1时'可对空白段落进行删除。''* ---------------------------------------Sub 删除空段() Dim i As Paragraph, n As Long Call 删除段首空格2 '调用工程 Application.ScreenUpdating = False '关闭屏幕刷新 For Each i In ActiveDocument.Paragraphs '在活动文档的段落集合中循环 If Len(i.Range) = 1 Then '判断段落长段,此处可根据文档实际情况...

VBA 2019-09-25 PM 4244℃ 0条
word vba 删除段首包含的关键词

word vba 删除段首包含的关键词

Sub 删除段首包含的关键词() Dim i As Paragraph, n As Long Application.ScreenUpdating = False '关闭屏幕刷新 For Each i In ActiveDocument.Paragraphs '在活动文档的段落集合中循环 For n = 1 To i.Range.Characters.Count If i.Range.Characters(1).Text = "一、" _ Or i.Range.Characters(1).Text =...

VBA 2019-09-25 PM 3006℃ 0条
Word下的几个VBA代码

Word下的几个VBA代码

删除文档中所有内容为空的行Sub DelBlank()Dim i as Paragraph, n as Long Application.ScreenUpdating = False For Each i In ActiveDocument.Paragraphs If Len(i.Range) = 1 Then i.Range.Delete n = n + 1 End If Next MsgBox "共删除空白段落" & n & "个。" Application.ScreenUpdat...

VBA 2019-09-25 PM 3723℃ 0条
wrod vba中调用 Function

wrod vba中调用 Function

Sub 查找相同字符个数()Text = InputBox("请输入您要查找到字符:", "信息提示")Dim result As StringFor i = 1 To 45Text = "[" + Trim(str(i)) + "]" '注意数值转成字符串会在前面加上空格,所以要用trim去除空格Text = Trim(Text)With ActiveDocument.Content.FindDo While .Execute(FindText:=Text) = Truetim = tim + 1LoopEnd With'输出到字符串result = result + Text +...

VBA 2019-09-25 PM 4118℃ 0条
word vba for 数组学习

word vba for 数组学习

Sub aaa()Ori = Array("a", "b", "c")For i = 0 To UBound(Ori)MsgBox Ori(i)NextEnd Sub

VBA 2019-09-25 PM 3548℃ 0条