TechWhirl (TECHWR-L) is a resource for technical writing and technical communications professionals of all experience levels and in all industries to share their experiences and acquire information.
For two decades, technical communicators have turned to TechWhirl to ask and answer questions about the always-changing world of technical communications, such as tools, skills, career paths, methodologies, and emerging industries. The TechWhirl Archives and magazine, created for, by and about technical writers, offer a wealth of knowledge to everyone with an interest in any aspect of technical communications.
Subject:Re: VBA Macro Help needed From:Peter Collins <peter -dot- collins -at- BIGFOOT -dot- COM> Date:Thu, 15 Oct 1998 14:38:35 +1000
You are concerned to avoid the outcome where
"the numbers will appear
like this:
RQD1
RQD11
RQD11.1"
Yes, I believe it can be done with a macro. The technique I would use
depends upon making a modification to the index string at the time of
creating the index entry, to mimic the Framemaker feature. Thus RDQ14.8
would become RDQ0014.800 (or RDQ 14.8 with spaces instead of zeros) and
the index sort would be as you seek. A structured 'english' outline of the
technique is:
1. Determine by any convenient means the maximum possible number of numeric
digits before and after the decimal point, either as they appear in the
document, or as a matter of policy. For this example I assume four before,
and three after, that is RQD1234.123. Go to the start of the file/document.
2. DO Find the next RQD number. If (not selection.find.found) the find
fails, stop.
3. Store your RQD number (RQD14.8, RQD854.76, etc.) in a macro variable and
count the number of characters (say, NUMCHAR) before the decimal point. If
NUMCHAR is less than seven (three for the RDQ and four digits) insert
(7-NUMCHAR) zeroes or spaces after character three. Then determine the
length of the resulting string. It should be 3+4+1+3=11. If it is less, add
trailing zeroes as required.
4. Use the result of step 2 in an index insertion.
5. LOOP while true (Repeat from step 2).
========================================================
Peter Collins, VIVID Management Pty Ltd,
26 Bradleys Head Road, MOSMAN 2088, Australia
+61 2 9968 3308, fax +61 2 9968 3026, mobile +61 (0)18 419 571
Management Consultants and Technical Writers
email: peter -dot- collins -at- bigfoot -dot- com ICQ#: 10981283
web pages: http://www.angelfire.com/pe/pcollins/
========================================================