M
malix0
When I double click to select a word I want that underscore will be
selected and not considered as a separator. If I double click on
the_word_with_underscore I want to select entire phrase includin
underscore and n ot only single word. I try to write this macro:
I create a class clsWordClass:
Public WithEvents appWord As Word.Application
Private Sub appWord_WindowBeforeDoubleClick(ByVal Sel As Selection,
Cancel As Boolean)
test
End Sub
and a module basGeneral
Dim objClass As New clsWordApp
Sub Register_EventHandler()
Set objClass.appWord = Word.Application
End Sub
Sub test()
c = ActiveDocument.Characters(Selection.End + 1)
If ActiveDocument.Characters(Selection.Words.First.End + 1) = "_"
Then
'Selection.End = Selection.End + 1
Selection.Start = Selection.Words.First.Start
Selection.End = Selection.Words.First.End + 1
MsgBox Selection.Text
End If
End Sub
------------------------------------------------
Then when I double click on a word the underscore get selected and the
MsgBox show a word that includes the underscore, but after only the
word without underscore remains selected. It will be possible with an
event like WindowAfterDoubleClick, but this does not exixts.
selected and not considered as a separator. If I double click on
the_word_with_underscore I want to select entire phrase includin
underscore and n ot only single word. I try to write this macro:
I create a class clsWordClass:
Public WithEvents appWord As Word.Application
Private Sub appWord_WindowBeforeDoubleClick(ByVal Sel As Selection,
Cancel As Boolean)
test
End Sub
and a module basGeneral
Dim objClass As New clsWordApp
Sub Register_EventHandler()
Set objClass.appWord = Word.Application
End Sub
Sub test()
c = ActiveDocument.Characters(Selection.End + 1)
If ActiveDocument.Characters(Selection.Words.First.End + 1) = "_"
Then
'Selection.End = Selection.End + 1
Selection.Start = Selection.Words.First.Start
Selection.End = Selection.Words.First.End + 1
MsgBox Selection.Text
End If
End Sub
------------------------------------------------
Then when I double click on a word the underscore get selected and the
MsgBox show a word that includes the underscore, but after only the
word without underscore remains selected. It will be possible with an
event like WindowAfterDoubleClick, but this does not exixts.