在word宏里找不到getcode这个选项

使用问题 · 395 次浏览
Elonots 创建于 2021-11-13 22:34

在word里没看到getcode

Elonots 最后更新于 2021/11/13

Ryans 2022-02-16 23:09 :

同求


ttChen 2022-04-05 21:15 :

最新版已解决了。相关介绍请访问https://blog.sciencenet.cn/blog-3427939-1332625.html

回复内容
ttChen 2022-04-02 12:41
#1

这个函数也要加进去


Public Sub Clipboard_SetText(sInput As String)

    On Error GoTo Error_Handler

    With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")

        .SetText sInput

        .PutInClipboard

    End With

Error_Handler_Exit:

    On Error Resume Next

    Exit Sub

Error_Handler:

    MsgBox "The following error has occurred" & vbCrLf & vbCrLf & _

           "Error Number: " & Err.Number & vbCrLf & _

           "Error Source: Clipboard_SetText" & vbCrLf & _

           "Error Description: " & Err.Description & _

           Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _

           , vbOKOnly + vbCritical, "An Error has Occurred!"

    Resume Error_Handler_Exit

End Sub

ttChen 2022-03-27 16:24
#2

请把下面的代码复制到模板文件的模块下

Sub getCode()

    Dim code As String

    With Selection

     .StartIsActive = False

     .Extend Character:=")"

    End With

    If Selection.Fields().Count > 0 Then

    Clipboard_SetText Selection.Fields(1).code

    Else

    Clipboard_SetText ""

    End If

End Sub

willyemchy 2022-03-04 18:47
#3
我的也没有
回复主贴