D
Debra Farnham
Win 2K
Word 2K
Hi All
Thank you to anyone in advance who has the patience to read this. I have
tried everything and read tons in these groups to try and resolve the
problems, but I'm not sure there is a bullet proof way of doing what I need.
Here's the situation (I'll try to be brief but in fear that brief may not be
descriptive enough ....... here goes.... )
When a user presses Alt + S, an inputbox appears, the user is prompted for
the name of a witness, and the witness name is then inserted into the
document with a colon, two spaces and the word SWORN following their name.
Additionally, I bookmark the name for use in a table later on.
code snippet for Alt + S (NASTY but it works for now until I clean it up
hopefully with ranges)
**************************************************
Dim strSwornName As String
strSwornName = InputBox("Enter Name of individual being sworn")
'Inserts name of witness being sworn
With Selection
.TypeText Text:=StrConv(strSwornName, vbUpperCase) & ": " & "SWORN"
.ParagraphFormat.Space15
.EndKey unit:=wdLine
.HomeKey unit:=wdLine, Extend:=wdExtend
.Font.UnderLine = wdUnderlineSingle
.MoveLeft unit:=wdCharacter, Count:=1
.MoveRight unit:=wdWord, Count:=1
.MoveRight unit:=wdWord, Count:=1, Extend:=wdExtend
End With
strWitnessName = Left(strSwornName, 1) & ". "
strWitnessName = strWitnessName & Trim(Mid(strSwornName,
InStrRev(strSwornName, " ")))
'Marks Last Name as bookmark for header
strWitnessLastName = StrConv(Selection.Range, vbProperCase)
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, name:=strWitnessLastName
End With
'Marks Last Name as bookmark for table of contents
strFWitnessName = Mid(strSwornName, InStrRev(strSwornName, " ")) &
", " & Left(strSwornName, InStr(strSwornName, " "))
********************************************
When a user presses Alt +1 , I have the text "EXAMINATION IN CHIEF BY" + a
document property being placed at the current location in the document.
code snippet
********************************
With myRng
.Text = strChief & " "
.InsertAfter ActiveDocument.CustomDocumentProperties("PTitle") & _
ActiveDocument.CustomDocumentProperties("PLastName") & ":"
.Case = wdUpperCase
.Font.UnderLine = wdUnderlineSingle
End With
***************************************
In addition to typing the text, the current code takes the name of the last
bookmark it finds in the file (the name of a witness), moves to a specified
table( table 1), inserts the bookmarked text in the first blank row and
bookmarked text page number in a specific column which is determined by the
type of examination. (Alt + 2 enters the text "CROSS-EXAMINATION BY" ...
(thus specifying a different column). That part works just fine. (Not very
elegant, but here's the gist of it - there's more but I thought this would
be enough. This piece only takes care of the Examination in Chief)
************************************************
otable.Range.Rows(otable.Rows.Count).Range.Select
With Selection
.InsertRowsBelow 1
.Collapse (wdCollapseStart)
End With
myrow = Selection.Information(wdStartOfRangeRowNumber)
With Selection
.TypeText Text:=StrConv(Trim(strFWitnessName),
vbProperCase)
.MoveLeft unit:=wdWord, Count:=3, Extend:=wdExtend
.Font.UnderLine = wdUnderlineNone
.MoveRight unit:=wdCell
Selection.InsertCrossReference
ReferenceType:="Bookmark", ReferenceKind:= _
wdPageNumber, ReferenceItem:=strBN,
InsertAsHyperlink:=False, _
IncludePosition:=False
End With
*******************************************************
I also need the header on the page where EXAMINATION IN CHIEF or
CROSS-EXAMINATION BY appears to print in the header .. however in a
different format. If ALT + 1 is pressed and EXAMINATION IN CHIEF BY appears
in the body, then the header must read "FirstInitial LastName of Witness -
in Ch." minus the quotation marks. If ALT + 2 is pressed and
CROSS-EXAMINATION BY appears in the body, then the header must read
"FirstInitial LastName of Witness - Cr. Ex.".
I have created subroutines to assemble the names properly for insertion in
the header as they are actually coming from custom document properties not
formatted the way they need to appear in the header.
The difficulty I AM having is twofold:
Problem #1
The header on all pages from section 3 to the end of the document must
ALWAYS include at least the following:
1.
R. v Name of Defendant
in addition to what I have described above (the in-Ch. or cr-Ex).on the
third line
The number 1 is the page number and a period
The R. v Name of Defendant is a field in the header that looks like this:
{ DOCPROPERTY "Header1" \* MERGEFORMAT }
Problem #2
Although the text EXAMINATION IN CHIEF BY .... may appear on page 3, that
individual's testimony may well carry over several pages until he/she is
finally CROSS-EXAMINED. At the page where the text CROSS-EXAMINATION BY
appears, the header will once again change to reflect the fact that the
cross-examination has now begun on that page. The page number and R. v Name
of Defendant must remain in the header and if the examination in chief
appears on the same page, that text must also remain in the header. I will
then need "FirstInitial LastName of Witness - cr-Ex." to appear on a fourth
line in the header.
Once a new witness is sworn in, the process begins again. That is, the
EXAMINATION IN CHIEF will have to be re-set in the header until the witness
is cross-examined etc. etc.
The document will continue to proceed in the same manner as potentially
hundreds (although that's probably excessive) of witnesses could testify.
Thank you to anyone brave enough to have read all this and further, have any
suggestions or recommendations.
Please let me know if I can clarify anything or whether I could have somehow
posted this in an easier to read format.
Legal jargon mixed with vba???? .... am I NUTS?
Debra
Word 2K
Hi All
Thank you to anyone in advance who has the patience to read this. I have
tried everything and read tons in these groups to try and resolve the
problems, but I'm not sure there is a bullet proof way of doing what I need.
Here's the situation (I'll try to be brief but in fear that brief may not be
descriptive enough ....... here goes.... )
When a user presses Alt + S, an inputbox appears, the user is prompted for
the name of a witness, and the witness name is then inserted into the
document with a colon, two spaces and the word SWORN following their name.
Additionally, I bookmark the name for use in a table later on.
code snippet for Alt + S (NASTY but it works for now until I clean it up
hopefully with ranges)
**************************************************
Dim strSwornName As String
strSwornName = InputBox("Enter Name of individual being sworn")
'Inserts name of witness being sworn
With Selection
.TypeText Text:=StrConv(strSwornName, vbUpperCase) & ": " & "SWORN"
.ParagraphFormat.Space15
.EndKey unit:=wdLine
.HomeKey unit:=wdLine, Extend:=wdExtend
.Font.UnderLine = wdUnderlineSingle
.MoveLeft unit:=wdCharacter, Count:=1
.MoveRight unit:=wdWord, Count:=1
.MoveRight unit:=wdWord, Count:=1, Extend:=wdExtend
End With
strWitnessName = Left(strSwornName, 1) & ". "
strWitnessName = strWitnessName & Trim(Mid(strSwornName,
InStrRev(strSwornName, " ")))
'Marks Last Name as bookmark for header
strWitnessLastName = StrConv(Selection.Range, vbProperCase)
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, name:=strWitnessLastName
End With
'Marks Last Name as bookmark for table of contents
strFWitnessName = Mid(strSwornName, InStrRev(strSwornName, " ")) &
", " & Left(strSwornName, InStr(strSwornName, " "))
********************************************
When a user presses Alt +1 , I have the text "EXAMINATION IN CHIEF BY" + a
document property being placed at the current location in the document.
code snippet
********************************
With myRng
.Text = strChief & " "
.InsertAfter ActiveDocument.CustomDocumentProperties("PTitle") & _
ActiveDocument.CustomDocumentProperties("PLastName") & ":"
.Case = wdUpperCase
.Font.UnderLine = wdUnderlineSingle
End With
***************************************
In addition to typing the text, the current code takes the name of the last
bookmark it finds in the file (the name of a witness), moves to a specified
table( table 1), inserts the bookmarked text in the first blank row and
bookmarked text page number in a specific column which is determined by the
type of examination. (Alt + 2 enters the text "CROSS-EXAMINATION BY" ...
(thus specifying a different column). That part works just fine. (Not very
elegant, but here's the gist of it - there's more but I thought this would
be enough. This piece only takes care of the Examination in Chief)
************************************************
otable.Range.Rows(otable.Rows.Count).Range.Select
With Selection
.InsertRowsBelow 1
.Collapse (wdCollapseStart)
End With
myrow = Selection.Information(wdStartOfRangeRowNumber)
With Selection
.TypeText Text:=StrConv(Trim(strFWitnessName),
vbProperCase)
.MoveLeft unit:=wdWord, Count:=3, Extend:=wdExtend
.Font.UnderLine = wdUnderlineNone
.MoveRight unit:=wdCell
Selection.InsertCrossReference
ReferenceType:="Bookmark", ReferenceKind:= _
wdPageNumber, ReferenceItem:=strBN,
InsertAsHyperlink:=False, _
IncludePosition:=False
End With
*******************************************************
I also need the header on the page where EXAMINATION IN CHIEF or
CROSS-EXAMINATION BY appears to print in the header .. however in a
different format. If ALT + 1 is pressed and EXAMINATION IN CHIEF BY appears
in the body, then the header must read "FirstInitial LastName of Witness -
in Ch." minus the quotation marks. If ALT + 2 is pressed and
CROSS-EXAMINATION BY appears in the body, then the header must read
"FirstInitial LastName of Witness - Cr. Ex.".
I have created subroutines to assemble the names properly for insertion in
the header as they are actually coming from custom document properties not
formatted the way they need to appear in the header.
The difficulty I AM having is twofold:
Problem #1
The header on all pages from section 3 to the end of the document must
ALWAYS include at least the following:
1.
R. v Name of Defendant
in addition to what I have described above (the in-Ch. or cr-Ex).on the
third line
The number 1 is the page number and a period
The R. v Name of Defendant is a field in the header that looks like this:
{ DOCPROPERTY "Header1" \* MERGEFORMAT }
Problem #2
Although the text EXAMINATION IN CHIEF BY .... may appear on page 3, that
individual's testimony may well carry over several pages until he/she is
finally CROSS-EXAMINED. At the page where the text CROSS-EXAMINATION BY
appears, the header will once again change to reflect the fact that the
cross-examination has now begun on that page. The page number and R. v Name
of Defendant must remain in the header and if the examination in chief
appears on the same page, that text must also remain in the header. I will
then need "FirstInitial LastName of Witness - cr-Ex." to appear on a fourth
line in the header.
Once a new witness is sworn in, the process begins again. That is, the
EXAMINATION IN CHIEF will have to be re-set in the header until the witness
is cross-examined etc. etc.
The document will continue to proceed in the same manner as potentially
hundreds (although that's probably excessive) of witnesses could testify.
Thank you to anyone brave enough to have read all this and further, have any
suggestions or recommendations.
Please let me know if I can clarify anything or whether I could have somehow
posted this in an easier to read format.
Legal jargon mixed with vba???? .... am I NUTS?
Debra