Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.



Public Function boolFindSelection(strText As String, boolCaseSensitive) As Boolean
' Procedure :     boolFindSelection
' Description:    Find text in a selection.
' Copyright: Chris Greaves
' Inputs:         A string of text to be found, a case-sensitive switch.
' Action:         None.
' Returns:        TRUE if the text is found.
' Assumes:        None
' Side Effects:   The selection point will change if the text is found.
' Tested:         By the calls shown below.
' Note:           If the case-sensitive flag is false, all searches will be forced to upper-case.
   Selection.Find.ClearFormatting
   With Selection.Find
      .Text = strText
      .Replacement.Text = ""
      .Forward = True
      .Wrap = wdFindStop
      .Format = False
      .MatchCase = boolCaseSensitive
      .MatchWholeWord = False
      .MatchWildcards = False
      .MatchSoundsLike = False
      .MatchAllWordForms = False
   End With
   boolFindSelection = Selection.Find.Execute
'Private Sub TESTboolFindSelection()
'    MsgBox boolFindSelection("hz", False)
'    Selection.MoveRight Unit:=wdCharacter, Count:=1
'    MsgBox boolFindSelection("h", False)
'End Sub
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1

Visual Basic (VB and VBA)

Copyright 1999-2001 Christopher Greaves. All rights reserved.
Home Page and email to [email protected]
If in doubt, record a macro and inspect the entrails!

 

 

Please read the DISCLAIMER.

Here is an INDEX to all the procedures.

You will probably need one copy of my GLOBAL DECLARATIONS.

Public Function boolFindSelection(strText As String, boolCaseSensitive) As Boolean
' Procedure :     boolFindSelection
' Description:    Find text in a selection.
' Copyright: Chris Greaves
' Inputs:         A string of text to be found, a case-sensitive switch.
' Action:         None.
' Returns:        TRUE if the text is found.
' Assumes:        None
' Side Effects:   The selection point will change if the text is found.
' Tested:         By the calls shown below.
' Note:           If the case-sensitive flag is false, all searches will be forced to upper-case.
   Selection.Find.ClearFormatting
   With Selection.Find
      .Text = strText
      .Replacement.Text = ""
      .Forward = True
      .Wrap = wdFindStop
      .Format = False
      .MatchCase = boolCaseSensitive
      .MatchWholeWord = False
      .MatchWildcards = False
      .MatchSoundsLike = False
      .MatchAllWordForms = False
   End With
   boolFindSelection = Selection.Find.Execute
'Private Sub TESTboolFindSelection()
'    MsgBox boolFindSelection("hz", False)
'    Selection.MoveRight Unit:=wdCharacter, Count:=1
'    MsgBox boolFindSelection("h", False)
'End Sub
End Function

We all knew nothing when we started …
Home Page and Contact Information
Send email to [email protected].
This page was last updated Thursday, November 15, 2001

 

 

Hosted by www.Geocities.ws

1