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 lngDropDuplicates(strDoc As String) As Long
' Procedure :   lngDropDuplicates
' Description:  Drop all duplicate (and empty) paragraphs from the named document.
' By:           Chris Greaves Inc.
' Inputs:       String Document name.
' Returns:      Count of duplicates (but not empty) dropped.
' Assumes:      None.
' Side Effects: The named document contents may change.
' Tested:       By the calls shown below.
    ' If there is but one paragraph, we have nothing to do.
    If Documents(strDoc).Paragraphs.Count <= 1 Then
    Else
        ' Give ourselves a fighting chance by using the system sort to get some sequence.
        On Error Resume Next
        Selection.Sort ExcludeHeader:=False, FieldNumber:="Paragraphs", SortFieldType:=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending, Separator:=wdSortSeparateByTabs, SortColumn:=False, CaseSensitive:=True, LanguageID:=wdLanguageNone
        ' Load paragraphs to array
        Dim strArp() As String
        Call LoadParagraphsToArray(strDoc, strArp) ' drop any discovered duplicates.
        ' Use our internal sort to sort the array
        Call QSort(strArp, 0, UBound(strArp), True)
        ' Select the entire document and overwrite it with the array contents
        Selection.WholeStory
        Call DumpArrayToParagraphs(strDoc, strArp) ' drop any discovered duplicates.
    End If
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 lngDropDuplicates(strDoc As String) As Long
' Procedure :   lngDropDuplicates
' Description:  Drop all duplicate (and empty) paragraphs from the named document.
' By:           Chris Greaves Inc.
' Inputs:       String Document name.
' Returns:      Count of duplicates (but not empty) dropped.
' Assumes:      None.
' Side Effects: The named document contents may change.
' Tested:       By the calls shown below.
    ' If there is but one paragraph, we have nothing to do.
    If Documents(strDoc).Paragraphs.Count <= 1 Then
    Else
        ' Give ourselves a fighting chance by using the system sort to get some sequence.
        On Error Resume Next
        Selection.Sort ExcludeHeader:=False, FieldNumber:="Paragraphs", SortFieldType:=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending, Separator:=wdSortSeparateByTabs, SortColumn:=False, CaseSensitive:=True, LanguageID:=wdLanguageNone
        ' Load paragraphs to array
        Dim strArp() As String
        Call LoadParagraphsToArray(strDoc, strArp) ' drop any discovered duplicates.
        ' Use our internal sort to sort the array
        Call QSort(strArp, 0, UBound(strArp), True)
        ' Select the entire document and overwrite it with the array contents
        Selection.WholeStory
        Call DumpArrayToParagraphs(strDoc, strArp) ' drop any discovered duplicates.
    End If
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