Text Editing

C

CyberBhai

I am using Visio Activex Control 2003 and VB.net 2003.

I have some shapes which are textboxes, means only having text.

My need is to select a portion of the string and change the color and font
as needed. I want to find out the position at which I have clicked on the
mouse and the position where I have made the mouse up.

At times I may be needing to select a character(s), and replace then with
the entered text.

Plz. Help
 
C

CyberBhai

Al,
I have gone thru them. But, I am unable to get any required info from
that.

I am having text to be edited as we do in Visio. In Visio's Macro editor,
any Custom color change is represented as '0#'. In character Section though
it represents the actual color but in rows. I am unable to get how many rows
are there in the Character Section through code.

Is there any way to get the 'RGB Color' converted to 'Short' format.

How can I get the starting Char Pos and and End Char Pos (In my case with
'BeforeEditText' event the Begin is 0 and End is 0 and with ExitTextEdit end
represents the width of the Text.

Plz. Help.
 
J

JuneTheSecond

I have an example., I hope to be a help.
Sub test()
Dim shp As Visio.Shape
Dim FindTxt As String
Dim ShapeTxt As String
Dim Istart As Long, INumber As Long
Set shp = ActivePage.Shapes(1)
ShapeTxt = shp.Text
FindTxt = "Visio"
Istart = InStr(1, ShapeTxt, FindTxt, vbTextCompare)
If Istart > 0 Then
INumber = Len(FindTxt)
SelectText shp, Istart, INumber
End If
End Sub

Sub SelectText(shp As Visio.Shape, Istart As Long, INumber As Long)
Dim I As Long
ActiveWindow.Select shp, visSelect
SendKeys "{F2}", True
SendKeys "{HOME}", True
For I = 1 To Istart - 1
SendKeys "{RIGHT}", True
Next
For I = 1 To INumber
SendKeys "+{RIGHT}", True
Next
End Sub
 

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