|
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 rngDocTags(strDoc As String, strTag1 As String, strTag2 As String, boolIncExc) As Range
' Procedure : rngDocTags
' Description: Attempt to build a range from two tags in a document.
' Copyright: Chris Greaves Inc.
' Inputs: Document name, two tags as strings, Inclusive/Exclusive switch.
' Returns: RANGE of data
' Assumes: The document is open.
' Side Effects: None
' Tested: By the calls shown below.
Dim doc As Document
Set rngDocTags = ActiveDocument.Range(Start:=0, End:=0)
Documents(strDoc).Activate
If boolFindNextOccurrence(strTag1) Then
If boolIncExc Then
Selection.Collapse (wdCollapseStart)
Else
Selection.Collapse (wdCollapseEnd)
End If
Dim lngStart As Long
lngStart = Selection.Start
If boolFindNextOccurrence(strTag2) Then
If boolIncExc Then
Selection.Collapse (wdCollapseEnd)
Else
Selection.Collapse (wdCollapseStart)
End If
Dim lngEnd As Long
lngEnd = Selection.End
'Procs Dim myRange As Range
Set rngDocTags = ActiveDocument.Range(Start:=lngStart, End:=lngEnd)
Else
End If
Else
End If
'Sub TESTrngDocTags()
' MsgBox rngDocTags(ActiveDocument.Name, "herald1", "herald2", True).Text
'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 |