Finding cursor position while editing a text field?

M

Meredith

I'm trying to write a VBA macro that will essential split one text box
into two text boxes right where my cursor is. (Basically I want to
split a couple of paragraphs apart so I can insert an example image
between them. I do this all the time, so if I could do it with a
single keystroke, I'd save TONS of time.)

My general algorithm is as follows:

(User double clicks in a shape to edit text, places cursor where the
text is to be split)
- Figure out what shape is selected
- Duplicate it
- Figure out where the cursor is located
- Delete cursor location to end of text in the original shape
- Delete beginning of text to cursor location in the duplicated shape
- Reposition them to be immediately above and below each other
(hopefully there's some way to detect or calculate the height of the
text in each shape, and position accordingly)

Everything was going smoothly until I tried to find a method that
would tell me where the cursor is currently editing. Does such a thing
exist, or am I stuck?

Unfortunately my original shape doesn't even seem to recognize it's
open for editing... its IsOpenForTextEdit boolean is always false when
I debug. I've pretty much lost all hope but thought I'd give the
community a chance to tell me I missed something :)

Any pointers would be hugely appreciated,

Meredith
 
J

JuneTheSecond

May be cursol position cannot be found,,
but Window.SelectedText can make
start and end position of selected text,
if you select at least one character.
Dim vsoCharacters1 As Visio.Characters
Set vsoCharacters1 = ActiveWindow.SelectedText
MsgBox vsoCharacters1.Begin & " " & vsoCharacters1.End
 
M

Meredith

June, thank you so much -- I was going around and around in circles on
this thing. Didn't know about ActiveWindow.SelectedText! I've got it
working now -- just have to figure out the finer details of how to
move the duplicated text box on the screen.

Thanks again!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top