小编use*_*970的帖子

对 Word 文件中的每个单词运行 VBA 宏

我已经根据我的需要调整了这个其他答案。我的更改查看填充的数组并将所选文本与标题文本而不是标题编号进行匹配,以及其他一些小的更改。

     Sub InsertCrossRef()
        'thank you stackoverflow:                
       /sf/ask/3329152151/
       reference-based-on-selection
            Dim RefList As Variant 'list of all available headings and 
            numbered items available
            Dim LookUp As String 'string to be lookedup
            Dim Ref As String 'reference string in which there is to be searched
            Dim s As Integer, t As Integer 'calculated variabels for the string changes
            Dim i As Integer 'looping integer

            On Error GoTo ErrExit
            With Selection.Range


                ' discard leading blank spaces
                Do While (Asc(.Text) = 32) And …
Run Code Online (Sandbox Code Playgroud)

vba words ms-word

3
推荐指数
1
解决办法
193
查看次数

标签 统计

ms-word ×1

vba ×1

words ×1