D
dvdastor
Hi All,
Below is a macro followed by a document that I am running through
looking for instances of a Test. The Tests are marked by [~Test
ID=xxxx~], (xxxx is a variable number). I need to select the range
from [~Test ID=xxxx~] to the beginning of the next Test tag.
When I use the macro below, I do not get the results I'm looking for
and I can't figure it out. I think it has something to do with the
hyperlinks I have in the document. When I delete them or make them non
hyperlinks, I get the range selection that I need. Can you offer any
help?
Sub SelectIt()
Dim rng As Range
Dim SearchRange As Range
Dim iTestCharCount As Integer
Set rng = ActiveDocument.Range
With rng
iTestCharCount = rng.Characters.Count
.Start = InStr(rng.Text, "[~Test ID=" & 9463 &
"~]") - 1
iCurrentTestTag = .Start
.End = InStr(.Start + 1, rng.Text, "[~Test
ID=")
iNextTestTag = .End
If iNextTestTag = 0 Then
.Start = iCurrentTestTag
.MoveEnd Word.WdUnits.wdCharacter,
iTestCharCount
Else
.Start = iCurrentTestTag
.End = (iNextTestTag + iCurrentTestTag) - 1
End If
.Select
'.Delete
End With
End Sub
-----------------DOCUMENT-----------------------
[~Exam ID=856~]97-TUT -[~ExamName~] Practice Import
[~Vendor~]Microsoft
[~ExamVersion~]Internal Version: 1.0.3
[~ExamDescription~]test
[~ExamInstructions~]
[~ExamResources~]test
'RANGE SHOULD START HERE
[~Test ID=9463~]
Test for Import
[~TestType~]Practice Test
[~ItemCount~]Item Count: 0
[~Objective ID=66428~]Here is the house
[~ObjSeq~]Objective Sequence: 1
[~SubObjective ID=274124~]Where it all happened
[~SubObjSeq~]1
[~SubShow~]False
[~Item~]
[~ItemType~]Single Answer Multiple Choice
[~ItemATID~]70-057.1.1.1
[~ItemText~]You are developing a Web site infrastructure for your Web
site, and you must meet the following requirements:
The required result is to be able to add VBScript functionality to the
Web pages.
The first optional result is to have the ability to run scripts on the
server for purposes of retrieving database information.
The second optional result is to be able to output this information in
HTML format so the majority of Web browsers can view this information.
The proposed solution is to implement Active Server Pages on a Windows
NT Server 4.0 computer that is running Site Server 3.0.
What does the proposed solution provide?
[~Item~]
[~ItemType~]Single Answer Multiple Choice
[~ItemATID~]70-057.1.1.2
[~ItemText~]
You are developing a Web site infrastructure for your Web site, and you
must meet the following requirements:
The required result is to be able to add VBScript functionality to the
Web pages.
The first optional result is to have the ability to run scripts on the
server for purposes of retrieving database information.
The second optional result is to be able to output this information in
HTML format so the majority of Web browsers can view this information.
The proposed solution is to implement a COM component.
What does the proposed solution provide?
[~RemediationText~]
COM components allow software to be written in components that perform
separate functions. This allows several procedures to call the same
components. None of the results are met by implementing a COM
component. To meet the results, you should use Active Server Pages.
www.yahoo.com
www.cnn.com
[~ReferenceText~]
1. General Knowledge and Experience - <none>
Here is more '<-- THE RANGE IS ENDING RIGHT AROUND HERE
www.kaplanit.com
www.erert.com
www.yahoo.com
www.cnn.com
'THIS IS WHERE I NEED TO RANGE TO END
[~Test ID=9466~]
Flash Card Test import
[~TestType~]Flash Card
[~ItemCount~]Item Count: 0
---------------------DOCUMENT END---------------------
Thanks for any help.
David
Below is a macro followed by a document that I am running through
looking for instances of a Test. The Tests are marked by [~Test
ID=xxxx~], (xxxx is a variable number). I need to select the range
from [~Test ID=xxxx~] to the beginning of the next Test tag.
When I use the macro below, I do not get the results I'm looking for
and I can't figure it out. I think it has something to do with the
hyperlinks I have in the document. When I delete them or make them non
hyperlinks, I get the range selection that I need. Can you offer any
help?
Sub SelectIt()
Dim rng As Range
Dim SearchRange As Range
Dim iTestCharCount As Integer
Set rng = ActiveDocument.Range
With rng
iTestCharCount = rng.Characters.Count
.Start = InStr(rng.Text, "[~Test ID=" & 9463 &
"~]") - 1
iCurrentTestTag = .Start
.End = InStr(.Start + 1, rng.Text, "[~Test
ID=")
iNextTestTag = .End
If iNextTestTag = 0 Then
.Start = iCurrentTestTag
.MoveEnd Word.WdUnits.wdCharacter,
iTestCharCount
Else
.Start = iCurrentTestTag
.End = (iNextTestTag + iCurrentTestTag) - 1
End If
.Select
'.Delete
End With
End Sub
-----------------DOCUMENT-----------------------
[~Exam ID=856~]97-TUT -[~ExamName~] Practice Import
[~Vendor~]Microsoft
[~ExamVersion~]Internal Version: 1.0.3
[~ExamDescription~]test
[~ExamInstructions~]
[~ExamResources~]test
'RANGE SHOULD START HERE
[~Test ID=9463~]
Test for Import
[~TestType~]Practice Test
[~ItemCount~]Item Count: 0
[~Objective ID=66428~]Here is the house
[~ObjSeq~]Objective Sequence: 1
[~SubObjective ID=274124~]Where it all happened
[~SubObjSeq~]1
[~SubShow~]False
[~Item~]
[~ItemType~]Single Answer Multiple Choice
[~ItemATID~]70-057.1.1.1
[~ItemText~]You are developing a Web site infrastructure for your Web
site, and you must meet the following requirements:
The required result is to be able to add VBScript functionality to the
Web pages.
The first optional result is to have the ability to run scripts on the
server for purposes of retrieving database information.
The second optional result is to be able to output this information in
HTML format so the majority of Web browsers can view this information.
The proposed solution is to implement Active Server Pages on a Windows
NT Server 4.0 computer that is running Site Server 3.0.
What does the proposed solution provide?
[~Item~]
[~ItemType~]Single Answer Multiple Choice
[~ItemATID~]70-057.1.1.2
[~ItemText~]
You are developing a Web site infrastructure for your Web site, and you
must meet the following requirements:
The required result is to be able to add VBScript functionality to the
Web pages.
The first optional result is to have the ability to run scripts on the
server for purposes of retrieving database information.
The second optional result is to be able to output this information in
HTML format so the majority of Web browsers can view this information.
The proposed solution is to implement a COM component.
What does the proposed solution provide?
[~RemediationText~]
COM components allow software to be written in components that perform
separate functions. This allows several procedures to call the same
components. None of the results are met by implementing a COM
component. To meet the results, you should use Active Server Pages.
www.yahoo.com
www.cnn.com
[~ReferenceText~]
1. General Knowledge and Experience - <none>
Here is more '<-- THE RANGE IS ENDING RIGHT AROUND HERE
www.kaplanit.com
www.erert.com
www.yahoo.com
www.cnn.com
'THIS IS WHERE I NEED TO RANGE TO END
[~Test ID=9466~]
Flash Card Test import
[~TestType~]Flash Card
[~ItemCount~]Item Count: 0
---------------------DOCUMENT END---------------------
Thanks for any help.
David