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 lngRemoveBookmarks(strBkMk As String) As Long
' Procedure :   lngRemoveBookmarks
' Description:  Remove all GENERIC bookmarks from the active document.
' By:           Chris Greaves Inc.
' Inputs:       STRING leading portion of identifiers (usually strcApplication)).
' Returns:      LONG number of bookmarks removed.
' Assumes:      Nothing
' Side Effects: None.
' Tested:       By the calls below.
    Dim lngCount As Long
    lngCount = ActiveDocument.Bookmarks.Count
    Dim lngItem As Long
    For lngItem = ActiveDocument.Bookmarks.Count To 1 Step -1
        Call strStatusBar("removing " & str(lngItem) & " of " & str(lngCount))
        If Left$(ActiveDocument.Bookmarks(lngItem).Name, Len(strBkMk)) = strBkMk Then
            ActiveDocument.Bookmarks(lngItem).Delete
        Else
        End If
        Call FlushEditUndo ' 2001/03/13
    Next lngItem
    lngRemoveBookmarks = lngCount - ActiveDocument.Bookmarks.Count
'Sub TESTlngRemoveBookmarks()
'    ActiveDocument.Words(1).Select
'    With ActiveDocument.Bookmarks
'        .Add Range:=Selection.Range, Name:="eraseme1"
'    End With
'    ActiveDocument.Words(3).Select
'    With ActiveDocument.Bookmarks
'        .Add Range:=Selection.Range, Name:="eraseme2"
'    End With
'    ActiveDocument.Words(5).Select
'    With ActiveDocument.Bookmarks
'        .Add Range:=Selection.Range, Name:="eraseme3"
'    End With
'    MsgBox lngRemoveBookmarks("eraseme") ' should be AT LEAST 3
'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 lngRemoveBookmarks(strBkMk As String) As Long
' Procedure :   lngRemoveBookmarks
' Description:  Remove all GENERIC bookmarks from the active document.
' By:           Chris Greaves Inc.
' Inputs:       STRING leading portion of identifiers (usually strcApplication)).
' Returns:      LONG number of bookmarks removed.
' Assumes:      Nothing
' Side Effects: None.
' Tested:       By the calls below.
    Dim lngCount As Long
    lngCount = ActiveDocument.Bookmarks.Count
    Dim lngItem As Long
    For lngItem = ActiveDocument.Bookmarks.Count To 1 Step -1
        Call strStatusBar("removing " & str(lngItem) & " of " & str(lngCount))
        If Left$(ActiveDocument.Bookmarks(lngItem).Name, Len(strBkMk)) = strBkMk Then
            ActiveDocument.Bookmarks(lngItem).Delete
        Else
        End If
        Call FlushEditUndo ' 2001/03/13
    Next lngItem
    lngRemoveBookmarks = lngCount - ActiveDocument.Bookmarks.Count
'Sub TESTlngRemoveBookmarks()
'    ActiveDocument.Words(1).Select
'    With ActiveDocument.Bookmarks
'        .Add Range:=Selection.Range, Name:="eraseme1"
'    End With
'    ActiveDocument.Words(3).Select
'    With ActiveDocument.Bookmarks
'        .Add Range:=Selection.Range, Name:="eraseme2"
'    End With
'    ActiveDocument.Words(5).Select
'    With ActiveDocument.Bookmarks
'        .Add Range:=Selection.Range, Name:="eraseme3"
'    End With
'    MsgBox lngRemoveBookmarks("eraseme") ' should be AT LEAST 3
'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