Word Note (No. 19)
Macros for checking 
formatting of Bills
Reissued October 2002
Updated January 2008
Contents
Introduction	3
CheckFormat	3
Things to check	3
Options box	3
Start checking from	3
Checking method	3
Programming messages	4
Screen updating	4
OK	4
Using the macro	4
Checking the errors	4
Checker macro	5
General description	5
Checklist documents	5
Using the macro	5
General	5
Selecting the options and running the macro	5
Checking the errors	6
Attachment A—Items in CheckFormat macro	7
All items	7
1)	section headings—2 spaces no tabs	7
2)	no tabs in various paragraphs	7
3)	2 tabs in various paragraphs	7
4)	Item headings—2 spaces no tabs	7
5)	One tab in various	7
6)	Unwanted double spaces	8
7)	Part heading after Chapter heading	8
8)	Division heading after Part heading	8
9)	Double quotes not bold or italic	8
10)	Part heading after Schedule heading	8
11)	Incorrect page breaks	8
12)	Revision marking	8
13)	Definition order	8
14)	Straight quote marks	9
15)	Amended Act Titles	9
Attachment B—Developing your own checklist	10
Bold or italics in string1 or string2	11
Spaces	11
Searching for whole words	11
Searching for part words	12
The Dist parameter	12
Default settings for searches	12
Miscellaneous notes about the Checklist table	12
Summary of Macro options	12
Examples of Checklist items	13
Examples of search wildcards (from WordXP help)	14
Notes	14

Introduction
1	A number of macros have been developed to check aspects of the formatting of Bills and compliance with various Drafting Directions. The macros that are available are:
(a)	CheckFormat; and
(b)	Checker.
2	This Word Note sets out details about using the macros to check Bills.
CheckFormat
3	The macro can be run by pressing the CheckFormat button on the Finalise button bar, by choosing Check Format from the OPC Macros, Checking menu, or by clicking on the Finalise button and selecting the appropriate option.
Things to check
4	When you call up the macro, a dialogue box will appear. On the left hand side of the dialogue box is a box headed “Things to check”. This box has a number of options.
5	Normally, you would search for All items.
6	Details of all of the checks are in Attachment A.
Options box
7	On the right hand side of the dialogue box are a number of options boxes. You can select the appropriate option before running the macro.
Start checking from
8	This option box does not operate at present. All checks must commence at the beginning of the document.
Checking method
9	This gives you 3 options:
(a)	prepare error list; or
(b)	mark errors in document; or
(c)	step through errors.
10	If you select prepare error list, a list of all of the errors that are detected are created in a separate document with hyperlinks to the errors. This is the safest option to select.
11	Mark the errors in the document, will then mark each of the errors as they occur in the document.
12	The step through errors methods stops the macro at each error to allow you to fix it.
Programming messages
13	If you check programming messages, a number of messages will appear as the macro is running to tell you about progress of the macro. You would normally leave this unchecked.
Screen updating
14	By turning the screen updating to On, you can see the macro work through the document and do the various searches that it is doing. However, the macro will work substantially more quickly with screen updating turned off.
OK
15	When you have selected the options that you want, click on the OK button. If you have not selected anything in the things to check box, the macro will immediately come back with a message telling you the macro has finished.
Using the macro
16	The macro can be run numerous times on the same Bill. It should always be run before the Bill is sent to editorial or to the Printer.
17	If you are going to check a long document, it is a good idea to exit out of Windows, come back into Windows and Word and then run the macro. This frees up all of the memory so that it is available for the macro.
18	While you are running the macro you may get a number of messages saying that Word will have insufficient memory to undo. When this occurs, just click OK or press Enter.
19	After the macro has finished, you will get a message saying how many errors have been detected.
Checking the errors
20	The list that is produced will show you the page, line and column of each error and what the error is. The word “View” is a link to the location of the error.
21	To check and correct the errors, hold down the Control key and click on the “View” link to go to the location of the error. Make sure that you have all of the symbols displayed (do this by pressing on the paragraph mark on the OPCStandard button bar). You can get back to the window containing the list by using the Window menu.
22	If you have marked the errors in the document, you can move through them by search for <<.
23	After you have corrected all of the errors, you should run the macro again to ensure that you have actually picked them all up.
Checker macro
General description
24	The Checker Macro uses a Main document and a Checklist document. The Checklist specifies criteria for various searches that are to be carried out on the Main document. The Macro then reports the instances in the Main document that match the search criteria.
Checklist documents
25	The Macro allows you to choose either a “standard” OPC Checklist or another Checklist (e.g. one that you have developed yourself). Attachment B has information about developing your own checklist.
26	There are currently 2 OPC checklists. Copies of these are stored in C:\OPC\WordXP on each machine. The first list looks for “drafting issues” and the second for “editorial issues”. The dividing line between these is fairly arbitrary in some cases.
27	If you find a check that you believe should be included in one of the checklists, please advise me. Similarly, I would appreciate it if you would provide me with a copy of any personal checklist that you develop.
Using the macro
General
28	The macro can be run numerous times on the same Bill. It should always be run before the Bill is sent to editorial or to the Printer.
29	The macro should be run using the first OPC Checklist fairly early in the drafting process as it will advise you of a number of people who need to be consulted about the contents of the Bill.
30	If you are going to check a long document, it is a good idea to exit out of Windows, come back into Windows and Word and then run the macro. This frees up all of the memory so that it is available for the macro.
31	While you are running the macro you may get a number of messages saying that Word will have insufficient memory to undo. When this occurs, just click OK or press Enter.
Selecting the options and running the macro
32	When you run the macro, an option box will appear. Select the options that you want to use and then press OK.
33	After the macro has finished, you will get a message saying how many matches have been detected.
Checking the errors
34	The list that is produced will show you the page, line and column of each error and what the error is. The word “View” is a link to the location of the error.
35	To check and correct the errors, hold down the Control key and click on the “View” link to go to the location of the error. Make sure that you have all of the symbols displayed (do this by pressing on the paragraph mark on the OPCStandard button bar). You can get back to the window containing the list by using the Window menu.
36	If you have marked the errors in the document, you can move through them by searching for <<.
37	After you have corrected all of the errors, you should run the macro again to ensure that you have actually picked them all up.

Stephen Mattingley
Director of Information Technology

Document History	
Release number	Release date	Document number	
1.0	24 March 2005	s05pu373.v01.doc	
2.0	20 April 2006	s05pu373.v02.doc	
3.0	02 August 2006	s05pu373.v03.doc	
4.0	21 December 2007	s05pu373.v04.doc	
5.0	07 January 2008	s05pu373.v05.doc	

Attachment A—Items in CheckFormat macro
All items
The first option is to check all items. This will then conduct all of the checks listed below. There is no need to click on any of the other boxes if All items is selected.
When checking a Bill, usually you would select all items unless there are particular checks that you do not want to perform.
1)	section headings—2 spaces no tabs
Option 1 will check all the section headings in the Bill to ensure that there are 2 spaces after the section number and that there are no tabs in the section heading.
2)	no tabs in various paragraphs
The second option checks to make sure that there are no tabs in paragraphs formatted with the following styles:
(a)	subsection2,ss2;
(b)	item,i;
(c)	definition,dd;
(d)	SubsectionHeading,ssh;
(e)	SubitemHeading,issh.
3)	2 tabs in various paragraphs
This option will check that there are 2 tabs in paragraphs formatted with the following styles:
	subsection,ss;
(f)	paragraph,a;
(g)	paragraph(sub),aa;
(h)	paragraph(sub-sub),aaa.
4)	Item headings—2 spaces no tabs
This option will check that there are 2 spaces after the item number and that there are no tabs in item headings.
5)	One tab in various
This option will check to ensure that there is only 1 tab in paragraphs formatted with the following styles:
	subitem,iss;
(i)	boxlist,bl;
(j)	note(text),n;
(k)	note(margin),nm;
(l)	note(para),na;
(m)	penalty.
6)	Unwanted double spaces
This option will check for any double spaces that occur in Bills. There should not be any double spaces in a Bill except for those in item headings and section headings.
7)	Part heading after Chapter heading
This option will check that there is a Part heading, or a “blank” Part heading after each Chapter heading. This is necessary for headers to work correctly.
8)	Division heading after Part heading
This option will check that there is a Division heading or a “blank” Division heading after each Part heading. This is necessary to ensure that headers work correctly.
9)	Double quotes not bold or italic
This check ensures that no quotes in Items or in Note(margin) are in bold or italic.
10)	Part heading after Schedule heading
This option will check that there is a Part heading or a “blank” Part heading after each amending Schedule heading. This is necessary to ensure that headers work correctly.
11)	Incorrect page breaks
This check ensures that all page breaks are in page break style and that no other paragraphs are formatted with the page break style.
12)	Revision marking
This check ensures that there are no revision marks in the Bill.
13)	Definition order
This check ensures that definitions are in alphabetical order.
14)	Straight quote marks
This check ensures that there are no straight quotation marks or apostrophes in the Bill.
15)	Amended Act Titles
This check looks at each amended Act title in the Bill and validates the title if it exists in the current citations in the Acts database. If it is not found in the current citations then the following places are checked:
	Old citations of Acts in the Acts database. If it is found in the old citations, then the error report will give the new citation as “(now cited as ....)”. 
(n)	The Act title with the word “Bill” instead of “Act” in IBIS. If it is found in IBIS, then the error will report “(found as ....Bill)”.
(o)	If it could not be found in either database then the error report will simply list the title of the Act.

Attachment B—Developing your own checklist
	A checklist document contains a table in the following format.
Ref
###	string1
[bold/ital]	+/-string1 Style 	+/-String2 [bold/ital]	Dist
(e.g. 7)	Once 
[y]	Report	
1	guilty		+offence	5>		DD-7/97 Offence? Refer Bill to Criminal Law	
38	The Macro only looks at the first 7 columns of the table. You can have additional columns (e.g.your own technical notes about an item).

Explanation of columns in Checklist	
Column	Heading	Content	Required?	Example(s)	Notes	
1	###	Reference number	recommended	1
A-27	Any reference system is acceptable. The Macro includes the reference number in its report.	
2	string1	first search term	required	aardvark		
3	+/- string1 Style	required or excluded Style for String1	optional	+subsection,ss	If a Style name is specified, it must be prefixed by + or -
The Style name must be specified exactly (including exact capitalisation and shortcut name).	
4	+/- string2	second search term	optional	stew	If string2 is specified, it must be prefixed by + or -
+ requires that string2 occurs within the specified distance of string1
- requires that string2 does not occur within Dist words of  string1.	
5	Dist	search range if string2 is specified	required if string2 is specified	6>
<6
<6>
p1>
<p1
<p1>
c1>
<c1
<c1>
	6> looks for string2 wholly within 6 words after the end of string1
<6  looks for string2 wholly within 6 words before the start of string1
p indicates paragraphs (instead of words) e.g. <p1> looks for string2 within the same paragraph as string1
c indicates characters (instead of words) e.g. <c1> looks for string2 within one character of string1	
6	once	once only option	optional	y	If y is specified, you can choose to report only the first match for items marked “y”, while reporting all matches for other items.	
7	notes	comment that will be reported with a match	recommended	see DD-6/99		

Optional prefixes for string1 and/or string2	
Prefix	Meaning	Notes	
c|	case-sensitive	Search is case-sensitive (default is non case-sensitive)	
f|	full (whole) words	Search for whole words only. Only works with single word.	
w|	wildcard	Search uses the Word97 “wildcard” feature.	
x|	exclusive bold or italic	italic only or bold only formatting will not find text that is both bold and italic	
cf|	c and f		
cx|	c and x		
px|	p and x		
cfx|	c, f and x		
Bold or italics in string1 or string2
39	If any part of string1 is Bold and/or Italic, this formatting will be included in the Find for the whole of string1. Similarly for string2. If x| is used, then italic only or bold only formatting will not find text that is both bold and italic.
Spaces
40	Spaces in the string1 or string2 column are treated as part of the search string. This can lead to unexpected results. For example, if you unintentionally include a space at the end of the string, or unintentionally include a space in an otherwise blank string2 cell.
Searching for whole words
41	You can use f| to specify a “full (whole) words only” search. However, if the search string contains more than 1 word, this condition is ignored. (e.g. “the day” will also find “the days”, “the daydreamer” etc.)
42	You can work around this limitation by using the Wildcard search. For example, “the day>”, in a Wildcard search, will not find “the daydreamer”, because “>” signifies the end of a word. Note however that a Wildcard search is automatically case sensitive.
Searching for part words
43	The search for string2 after string1 starts immediately after the end of string1. As a result, if string1 is not a whole word, the search for string2 might begin in the middle of a word. The remainder of the word then counts as a full word for the purposes of the Dist parameter. This feature can be helpful when constructing search items. For example, to find the string “bank” except where it occurs in “bankrupt” (and variants): string1 = “bank” string2 = -rupt Dist = 1.
The Dist parameter
44	This indicates the area around string1 that will be searched for string2. The default is number of words. To specify a number of paragraphs instead, include “p” before the number.
•	p1>	From the end of string1 to the end of the paragraph.
•	<p1>	String1 and string2 within the same paragraph.
•	<p2>	From the end of string1 to the end of the next paragraph, and from the start of string1 to the start of the previous paragraph.
•	c1>	From the end of string1 to the end of the next character.
•	<c1>	String1 and string2 within a character.
Default settings for searches
45	The default settings are the same as in the Word97 Find:
•	Match case			OFF
•	Find whole words only	OFF
•	Use wildcards			OFF
Miscellaneous notes about the Checklist table
46	The table must have one header row and no blank rows. 
47	For a wildcard search, * is interpreted as a wildcard operator. For a non-wildcard search it is interpreted as a “literal” (i.e. asterisk character)
48	The Macro searches for ### in order to find the first cell in the Checklist Table (i.e. other text is allowed before the table, but cannot contain ###).
49	+/- appears before optional prefixes e.g. +c|worms
Summary of Macro options
Summary of Macro options	
##	string1	string2	Dist	Notes	
Optional prefixes	c| = case sensitive
f| = full words
w| = wildcard
cf| = case sensitive and full word	c| = case sensitive
f| = full words
w| = wildcard
cf| = case sensitive and full word	p	prefix is always lower case	
Compulsory prefixes/suffixes	[none]	+
-	<
>
	+/- appears before the optional prefixes eg
+c|authorised	
Optional formatting	bold and/or italic	bold and/or italic	n/a		
Optional Style	+/-StyleName for string1 Style	n/a	n/a		
Examples of Checklist items
50	The following table contains some sample Checklist items.
Ref
###	string1
[bold/ital]	+/-string1 Style 	+/-String2 [bold/ital]	Dist
(e.g. 7)	Once 
[y]	Report	
1	guilty		+offence	5>		DD-7/97 Offence? Refer Bill to Criminal Law	
2	c|Commencement	+ActHead 5,s	+c|Subject to	10>		Split commencement? Check covering section for Schedule(s)	
3	insolvent under administration	+Definition,dd			y	DD-16/1995: definition of "insolvent under administration"	
4	w|Act [12]	+LongT	+w|Act [12]	10>		Avoid multiple Act names in long title?	
5	corporation		+51(xx) of the Constitution	10>		DD-5/1995: Form of referring to 51(xx) corporations	
6	:^t		+w|<[a-z]	1>		Example, note or penalty should not start with lower case word	
7	c|Interpretation	+ActHead 5,s	+^p	2>		"Interpretation" should be "Definitions"?	
8	f|he		-f|she	3>		Sexist: he without she	
9	w|<an [bcdfghjklmnpqrstvwxyz]					"an" should be "a"?	
10	heading	+ItemHead,ih	+cf|insert	p2>		Heading should be replaced, not amended? WN4-2.2	
11	penalty:	-Penalty				Penalty should have "Penalty" Style	
12	^p	+Definition,dd	-w|[.:]	<2		Paragraph with Definition Style should end with stop or colon	
13	w|[0-9][ap]m					am/pm should be preceded by a space	
14	w|[a-z,A-Z],[! ]					Comma should be followed by a space?	
Examples of search wildcards (from WordXP help)
To find	Use this wildcard	Examples	
Any single character	?	s?t finds "sat" and "set."	
Any string of characters	*	s*d finds "sad" and "started."	
One of the specified characters	[ ]	w[io]n finds "win" and "won."	
Any single character in this range	[-]	 [r-t]ight finds "right" and "sight." Ranges must be in ascending order.	
Any single character except the characters inside the brackets	[!]	m[!a]st finds "mist" and "most," but not "mast."	
Any single character except characters in the range inside the brackets	[!x-z]	t[!a-m]ck finds "tock" and "tuck," but not "tack" or "tick."	
Exactly n occurrences of the previous character or expression	{n}	fe{2}d finds "feed" but not "fed."	
At least n occurrences of the previous character or expression	{n,}	fe{1,}d finds "fed" and "feed."	
From n to m occurrences of the previous character or expression	{n,m}	10{1,3} finds "10," "100," and "1000."	
One or more occurrences of the previous character or expression	@	lo@t finds "lot" and "loot."	
The beginning of a word	<	<(inter) finds "interesting" and "intercept," but not "splintered."	
The end of a word	>	(in)> finds "in" and "within," but not "interesting."	
Paragraph mark	^13	[= ^p in non-wildcard search]	
Section/page break	^12	[= ^b in non-wildcard search]	
White space	<space>{1,}	[= ^w in non-wildcard search]	
Notes
51	You can use parentheses to group the wildcards and text and to indicate the order of evaluation. For example, search for "<(pre)*(ed)>" to find "presorted" and "prevented."
52	To search for a character that's defined as a wildcard, type a backslash (\) before the character. For example, search for "\?" to find a question mark.
You can use the \n wildcard to search for an expression and then replace it with the rearranged expression. For example, type (Quiggin) (Peter) in the Find what box and \2 \1 in the Replace with box. Word will find "Peter Quiggin" and replace it with "Quiggin Peter."