摘要: 步骤 1:Word 中用特殊标记替换换行 选中整个表格,按 Ctrl + H 打开「查找和替换」。 查找内容:输入 ^p(Word 硬回车)。 替换为:输入一个表格中绝对不存在的特殊符号(比如 |||,确保和内容无冲突)。 点击「全部替换」,此时 Word 单元格内的换行将被 ||| 替代,单元格显 阅读全文
posted @ 2025-09-05 22:23 python_learn 阅读(230) 评论(0) 推荐(0)
摘要: Sub 查找并操作() Dim arr Set 日期标记单元格 = Cells.Find("出生日期", lookat:=xlWhole, searchorder:=xlRows) If Not 日期标记单元格 Is Nothing Then 第一个找到符合内容的地址 = 日期标记单元格.Addre 阅读全文
posted @ 2025-09-05 17:34 python_learn 阅读(8) 评论(0) 推荐(0)
摘要: Sub 批量将数字设置为文本格式() 文件名 = Dir("C:\Users\Administrator\Desktop\拆分\") Do While 文件名 <> "" Set wb = Workbooks.Open(Filename:="C:\Users\Administrator\Deskto 阅读全文
posted @ 2025-09-05 17:33 python_learn 阅读(13) 评论(0) 推荐(0)
摘要: Sub 查找户主信息() Dim i As Long, j As Long, 被查找值的行号 As Long Dim 查找的名字 As String, 匹配的户主身份证 As String, 匹配的户主关系 As String Dim 被查找值 As Variant Dim 被查找表格 As Wor 阅读全文
posted @ 2025-09-04 00:03 python_learn 阅读(14) 评论(0) 推荐(0)
摘要: Shape(形状对象) ├─ 基础属性(标识与定位) │ ├─ Name:形状名称(字符串) │ ├─ ID:形状唯一标识符(整数) │ ├─ Left/Top:形状左上角坐标(相对于页面/容器) │ ├─ Width/Height:形状宽/高 │ └─ Type:形状类型(如 msoTextBox 阅读全文
posted @ 2025-09-03 23:55 python_learn 阅读(17) 评论(0) 推荐(0)
摘要: 将word文档的自动编号列表项转换为手动编号文本 For Each 序号 In 文档.Lists 序号.ConvertNumbersToText 插入空行、软回车转为硬回车、删除空行、删除井号 Sub 在每段后插入空行() ' ' 在每段后插入空行 宏 ' ' Selection.Find.Clea 阅读全文
posted @ 2025-09-01 23:53 python_learn 阅读(9) 评论(0) 推荐(0)
摘要: 方法一: thisDocument.Windows(1).Panes(1).Pages.Count 方法二: thisDocument.Range.Information(wdNumberOfPagesInDocument) 方法二: thisDocument.BuiltInDocumentProp 阅读全文
posted @ 2025-08-31 14:41 python_learn 阅读(50) 评论(0) 推荐(0)
摘要: Set rg = doc.GoTo(wdGoToPage, wdGoToAbsolute, 3) rg.Select rg.SetRange rg.Start, rg.Bookmarks("\page").End rg.Copy 以上代码功能(定位到第3页开头,然后复制第3页内容) 可以用下面简化代 阅读全文
posted @ 2025-08-31 12:22 python_learn 阅读(6) 评论(0) 推荐(0)
摘要: Sub 处理会议议程() Dim 领导议程数组 As Variant 文档内容 = ThisDocument.Content.Text ' 【创建正则表达式对象,并执行匹配】 Set 正则表达式对象 = CreateObject("VBScript.RegExp") 议程模式 = "([一二三四五六 阅读全文
posted @ 2025-08-28 02:26 python_learn 阅读(27) 评论(0) 推荐(0)
摘要: Sub 替换word中带格式的文本() Set 范围 = ThisDocument.Content 范围.Find.Font.Bold = True '找粗体 范围.Find.Text = "123" '找字符为123 范围.Find.Replacement.Font.Bold = False '替 阅读全文
posted @ 2025-08-27 23:34 python_learn 阅读(12) 评论(0) 推荐(0)