Selected note text

  • 1
  • Question
  • Updated 1 year ago

How can selected note text be captured?

I tried using the "Topic.Notes.Get Selection( startLng, endLng)" method, and it will not compile. Not sure what I am missing.

Photo of Philip Stipcevich

Philip Stipcevich

  • 31 Posts
  • 1 Reply Like

Posted 1 year ago

  • 1
Photo of John Griffith

John Griffith

  • 8 Posts
  • 0 Reply Likes
I simply copy the selected text and paste it into the notes.  It seems to work fine and most often retains the format of the note itself.
Photo of Ary Velstra, Expert Trainer

Ary Velstra, Expert Trainer

  • 1303 Posts
  • 197 Reply Likes
Maybe you could share with us What you want in detail and Why you want it. That helps us define if we know a soluton yes/no. Thanks for that
Photo of aHa!Coaching

aHa!Coaching, Champion

  • 1192 Posts
  • 116 Reply Likes
Looks like this is a programming question, perhaps using MindManager's Object Model?

Normally it should be something like this, but it seems to return empty values:
Sub Main
Dim t As Topic
Set t = ActiveDocument.Selection.PrimaryTopic
MsgBox(t.Notes.SelectedText)
End Sub
(Edited)
Photo of Nigel Goult (Olympic & MIVAP)

Nigel Goult (Olympic & MIVAP)

  • 348 Posts
  • 134 Reply Likes
Try this:

Dim oTopic As Topic
Dim oNotes As Notes
Set oTopic = ActiveDocument.Selection.PrimaryTopic
Set oNotes = oTopic.Notes
oNotes.SetSelection(1,3)
MsgBox(oNotes.SelectedText)

Replace (1,3) to represent your selection.

Regards
Nigel
Photo of Philip Stipcevich

Philip Stipcevich

  • 31 Posts
  • 1 Reply Like

Mathieu is correct. It is a macro programming question.

I tried the same logic with "SelectedText" first and could not get the get it to work. So I tried the "GetSelection" call next (which prompted this posting) and could not even get it to compile with the required arguments. Based on this behavior I thought I was missing something if two different notes functions were not working as expected. Now I am not sure is this may be a product issue.

To answer Ary's question, my original intent was to use this function in custom formatting of notes in large complex maps.(eg select a portion of the text in a note and then run different macros for different formatting needs without having to manually repeat the steps.)   

Many thanks for your attention! 

Photo of Philip Stipcevich

Philip Stipcevich

  • 31 Posts
  • 1 Reply Like
Just saw Nigel's reply. Trying his suggestion next.
Photo of Philip Stipcevich

Philip Stipcevich

  • 31 Posts
  • 1 Reply Like

Nigel's code technically works. However, you need to set the text manually (though the call start/end arguments) rather than by selecting the text via the mouse and having the procedure call return what was selected on screen.

Are there any other potential solutions for this issue?