使用失败,没有找到 getcode

使用问题 · 441 次浏览
willyemchy 创建于 2022-03-06 16:32
根据作者的设置,没有看到getcode,这个选项

ttChen 2022-04-05 21:14 :
最新版已解决了。相关介绍请访问https://blog.sciencenet.cn/blog-3427939-1332625.html
回复内容
ttChen 2022-03-27 16:17
#1

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

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

ttChen 2022-04-02 12:39
#2

这个函数,也要加进去

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

回复主贴