[VBA, MMCpAsLinkDIY] how to send some strings to clipboard? failed many times.
Discussion Open
didn't found in the api manual neither.
could use some help.
thx
ps: almost finished MMCpAsLinkDIY,
only cant copy into the clipboard. otherwise same as in the UI.
Also the gpt4 ALWAYS add application/ActiveDocument before the
Utilities here:
topicOID = Utilities.GuidBase64ToRegistry(topicGUID)
must manually remove them.
Option Explicit Sub Main() CopyTopicLink End Sub Sub CopyTopicLink() Dim selectedTopic As Topic Dim topicLink As String Dim topicGUID As String Dim topicOID As String Dim documentPath As String Dim documentName As String ' Get selected topic Set selectedTopic = ActiveDocument.Selection.PrimaryTopic ' Get the topic GUID topicGUID = selectedTopic.Guid ' Convert GUID to OID using ActiveDocument.Utilities.GuidBase64ToRegistry topicOID = Utilities.GuidBase64ToRegistry(topicGUID) ' Clear the Output tab and print three empty lines Call ClearOutputTab Debug.Print vbCrLf & vbCrLf & vbCrLf ' Print the topic GUID to the Output tab Debug.Print "Topic GUID: " & topicGUID ' Print the topic OID to the Output tab Debug.Print "Topic OID: " & topicOID ' Get the document path and name documentPath = ActiveDocument.Path documentName = ActiveDocument.Name ' Encode spaces in the document path and name documentPath = Replace(documentPath, " ", "%20") documentName = Replace(documentName, " ", "%20") ' Generate the topic link topicLink = "mj-map:///" & documentPath & "\" & documentName & "#oid=" & topicOID ' Copy the topic link to the clipboard ' Call Clipboard.SetData(topicLink) ' Print the topic link to the Output tab Debug.Print "The topic link: " & topicLink ' Add hyperlink to the selected topic using the topicGUID ' selectedTopic.Hyperlinks.AddHyperlinkToTopicByGuid topicGUID, topicLink ' Inform the user that the link has been copied to the clipboard MsgBox "The topic link has been copied to the clipboard and added as a hyperlink." End Sub Sub ClearOutputTab() ' Clear the Output tab by printing a large number of empty lines Dim i As Integer For i = 1 To 100 Debug.Print vbCrLf Next i End Sub
The function "Clipboard Text$" is described in the WWB.com documentation.
The function "Clipboard Text$" is described in the WWB.com documentation.
---