Word中英文引号替换为中文

Sub ReplaceEnglishQuotesWithChinese()

Dim rng As Range

Dim doubleQuoteOpen As Boolean

Dim singleQuoteOpen As Boolean

Set rng = ActiveDocument.Content

doubleQuoteOpen = True

singleQuoteOpen = True

With rng.Find

.ClearFormatting

.MatchWildcards = False

.Forward = True

.Wrap = wdFindStop

.Format = False

.MatchCase = False

.MatchWholeWord = False

' 替换英文双引号

Do While rng.Find.Execute(FindText:="""", Replace:=wdReplaceNone)

If doubleQuoteOpen Then

rng.Text = """

Else

rng.Text = """

End If

doubleQuoteOpen = Not doubleQuoteOpen

rng.Collapse wdCollapseEnd

Loop

' 重设范围

Set rng = ActiveDocument.Content

' 替换英文单引号

Do While rng.Find.Execute(FindText:="'", Replace:=wdReplaceNone)

If singleQuoteOpen Then

rng.Text = "'"

Else

rng.Text = "'"

End If

singleQuoteOpen = Not singleQuoteOpen

rng.Collapse wdCollapseEnd

Loop

End With

MsgBox "英文引号已替换为中文引号!"

End Sub

  • 打开 Word;

  • 按下 Alt + F11 打开 VBA 编辑器

  • 菜单栏 → 插入模块

  • 将上面的代码粘贴进去;

  • 关闭编辑器;

  • 在 Word 中按 Alt + F8

  • 选择 ReplaceEnglishQuotesWithChinese → 点击"运行"

相关推荐
Ai-_Man1 天前
豆包智能体内容批量导出:哪些该存、存成什么、怎么存v
人工智能·ai·小程序·word
weixin_416660071 天前
解决方案:DeepSeek不支持直接导出Word
word
2601_965912912 天前
PDF转Word工具深度横评:2026年国内免费方案技术对比
pdf·word
L歪歪君 山水甲天2 天前
Office文件的奥秘——.NET平台下不借助Office实现Word、Powerpoint等文件的解析(1)
word·powerpoint·.net
SpaceAIGlobal2 天前
Word文档一键转PPT?4种方法实测对比与选型分析(2026)
word·powerpoint
随手工具-Excel, pdf, SQL3 天前
多个 PDF 怎么合并成一个?免费在线工具,还能混入图片和 Word
pdf·word·效率工具·在线工具·pdf合并·合并pdf
ms365copilot3 天前
在Copilot聊天中添加Word、Excel 和 PowerPoint 代理
word·excel·copilot
2601_965912833 天前
PDF转Word技术选型:2026年文档解析引擎性能对比与集成评估
pdf·word
大数据张老师3 天前
Typora 导出 Word 模版操作手册
开发语言·c#·word·typora
DS随心转小程序5 天前
实测评测 AI 导出鸭转化效能,全方位优化 DeepSeek 输出 word 文档落地使用效率
人工智能·aigc·word·豆包·deepseek·ai导出鸭