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 AddToTable(varStyleRanges(), strStylename)
' Procedure :   AddToTable
' Description:  Append a set of ranges for all occurrences of the named style.
' By:           Chris Greaves Inc.
' Inputs:       Variant array (style/range), STRING style name.
' Returns:      None.
' Assumes:      Nothing
' Side Effects: None.
' Tested:       By the calls below.
    Dim intUbound As Integer
    intUbound = UBound(varStyleRanges, 2)
    Selection.Find.ClearFormatting
    On Error GoTo Failed
    Selection.Find.Style = ActiveDocument.Styles(strStylename) ' 2000/10/25 fails 5941
    With Selection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    While Selection.Find.Execute
        intUbound = UBound(varStyleRanges, 2)
        varStyleRanges(0, intUbound) = strStylename
        varStyleRanges(1, intUbound) = Selection.Range.Start
        varStyleRanges(2, intUbound) = Selection.Range.End
        ReDim Preserve varStyleRanges(2, intUbound + 1)
    Wend
    Selection.Find.ClearFormatting
Failed:
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 AddToTable(varStyleRanges(), strStylename)
' Procedure :   AddToTable
' Description:  Append a set of ranges for all occurrences of the named style.
' By:           Chris Greaves Inc.
' Inputs:       Variant array (style/range), STRING style name.
' Returns:      None.
' Assumes:      Nothing
' Side Effects: None.
' Tested:       By the calls below.
    Dim intUbound As Integer
    intUbound = UBound(varStyleRanges, 2)
    Selection.Find.ClearFormatting
    On Error GoTo Failed
    Selection.Find.Style = ActiveDocument.Styles(strStylename) ' 2000/10/25 fails 5941
    With Selection.Find
        .Text = ""
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindContinue
        .Format = True
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    While Selection.Find.Execute
        intUbound = UBound(varStyleRanges, 2)
        varStyleRanges(0, intUbound) = strStylename
        varStyleRanges(1, intUbound) = Selection.Range.Start
        varStyleRanges(2, intUbound) = Selection.Range.End
        ReDim Preserve varStyleRanges(2, intUbound + 1)
    Wend
    Selection.Find.ClearFormatting
Failed:
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