自动给word文档参考文献添加中括号方括号的VBA代码
时间:2023-12-13 00:27:58
下面的这一段宏代码,在Word环境下使用,其功能是,自动给word文档参考文献添加中括号或方括号
'AddMarkRef Macro
Dim parag As Paragraph
Dim selRge As Range
Dim rge As Range
Dim nField As Integer
Dim nParag As Integer
Set selRge = Selection.Range
MsgBox "在使用宏代码之前您应先选择好参考文献?"
ActiveDocument.ActiveWindow.View.FieldShading = wdFieldShadingWhenSelected
For nParag = 1 To selRge.Paragraphs.Count
Set rge = selRge.Paragraphs(nParag).Range
rge.Select
nField = Selection.Fields.Count
For i = 1 To nField
rge.Select
If Selection.Fields.Count >= 1 Then
With Selection.Fields(i)
.Update
.Select
End With
Selection.Cut
Selection.InsertBefore ("[")
Selection.Collapse Direction:=wdCollapseEnd
Selection.Paste
Selection.InsertAfter ("] ")
End If
Next i
Next nParag
End Sub
标签:自动给word文档参考文献添加中括号方括号的VBA代码
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
华为手机助手该怎样导入通讯录?
2022-04-21 03:29:46
![](https://img.aspxhome.com/file/2023/8/a338291_0s.jpg)
win10开机密码怎么取消 win10开机密码清除教程
2023-05-28 12:24:05
![](https://img.aspxhome.com/file/2023/28/a247681_0s.png)
电脑屏幕有条纹怎么办 显示器花屏的解决方法
2023-05-16 04:43:46
![](https://img.aspxhome.com/file/2023/3/a293473_0s.jpg)
wps多级编号怎么用?
2022-07-19 22:45:03
![](https://img.aspxhome.com/file/2023/3/a168753_0s.jpg)
excel的迷你图怎么创建
2022-10-09 17:21:31
![](https://img.aspxhome.com/file/2023/1/a140831_0s.jpg)
Win10 potplayer经常弹出“自动更新提示”解决方法
2023-12-22 08:05:46
![](https://img.aspxhome.com/file/2023/3/a292283_0s.jpg)
怎么设置蜜蜂剪辑画中画 蜜蜂剪辑添加编辑画中画效果的教程
2023-04-30 23:43:56
让excel表格中手机号码分段显示的设置方法
2022-04-08 06:40:33
2020年i5处理器排行榜 i5处理器天梯图排行榜2020
2022-02-27 01:41:16
![](https://img.aspxhome.com/file/2023/6/a324098_0s.jpg)
win7在资源管理器左侧列表里找不到回收站的解决方法
2023-08-31 05:34:29
WPS表格2013中如何创建帕累托图
2023-10-29 03:07:08
win10系统文件后缀名要怎么显示
2023-01-17 07:30:28
![](https://img.aspxhome.com/file/2023/5/a317020_0s.jpg)
ios14emoji更新了哪些_ios14emoji详细更新介绍
2022-09-13 21:22:17
![](https://img.aspxhome.com/file/2023/4/a306939_0s.jpg)
npkcrypt服务启动失败的原因及解决办法
2023-03-07 14:12:45
![](https://img.aspxhome.com/file/2023/5/a319245_0s.gif)
QQ浏览器如何拦截页面广告?QQ浏览器拦截页面广告的方法
2022-08-02 01:55:43
![](https://img.aspxhome.com/file/2023/8/a337305_0s.jpg)
笔记本win10系统开机黑屏电脑风扇不转的解决方法
2023-06-19 10:45:37
![](https://img.aspxhome.com/file/2023/3/a298708_0s.jpg)
Win8系统防火墙怎么关闭?Win8关闭防火墙的方法
2022-06-12 01:27:35
![](https://img.aspxhome.com/file/2023/28/a242854_0s.jpg)
Windows一键还原方法
2023-10-08 17:24:38
![](https://img.aspxhome.com/file/2023/1/a276724_0s.gif)
virtualBox与Win10不兼容怎么办?virtualBox与Win10不兼容的解决方法
2023-11-02 21:44:52
![](https://img.aspxhome.com/file/2023/1/a277467_0s.jpg)
bios设置u盘启动图解教程
2023-03-23 07:26:26
![](https://img.aspxhome.com/file/2023/6/a320733_0s.jpg)