Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ragged hanging indent on numbered list

55 views
Skip to first unread message

Gerard Alan Latham

unread,
Jun 1, 1998, 3:00:00 AM6/1/98
to

Word 97
I have written a macro to format a txt document. It works fine on my
machine but when I copy the normal.dot file to another machine (where it
was to function) the hanging indents are not in a straight line down the
page.

The document has the form:

1. text description
text description continued

2. next text description etc, etc

^ this is where the line is ragged.


Can anyone tell me how to fix this, please.
--
Regards,
Gerard Alan Latham. mailto:ger...@galatham.demon.co.uk

Cindy Meister -WordMVP-

unread,
Jun 3, 1998, 3:00:00 AM6/3/98
to

Hi Gerard,

> I have written a macro to format a txt document.
>

Could you copy/paste the macro code to a message - then we might be
able to see something more...

Cindy Meister
INTER-Solutions, Switzerland

This reply is posted in the Newsgroup; please post any follow-up
question or reply in the newsgroup and not by e-mail :-)


Gerard Alan Latham

unread,
Jun 5, 1998, 3:00:00 AM6/5/98
to

In article <VA.00000848.0092e609@default>, Cindy Meister -WordMVP-
<CindyM...@compuserve.com> writes

>Hi Gerard,
>
>> I have written a macro to format a txt document.
>>
>Could you copy/paste the macro code to a message - then we might be
>able to see something more...
My apologies to all as this seems rather long. Please also note that
this is my first attempt at VBA.

The form of the original text file *.man is:
1. A Royal Doulton series ware plate, "The Magar", a Mason's
Ironstone plate, and two other floral decorated plates #80-120
2. An early 19th Century pottery figure of a classical maiden by an
altar, decorated in the Wood manner, 9" high (restored) #40-60
3. A Kakiemon type lobed dish with floral decoration, 9 3/4" dia
#100-150
4. A Royal Worcester oviform two handle vase with peacock decoration
on an apple green ground, by Sedgley, 8" high (small chips) #100-150
etc etc.

The final form should be:

CERAMICS AND GLASS
1. A Royal Doulton series ware plate, "The Magar", a Mason's
Ironstone plate, and two other floral decorated plates
Ł80-120

2. An early 19th Century pottery figure of a classical maiden by an
altar, decorated in the Wood manner, 9" high (restored)
Ł40-60

3. A Kakiemon type lobed dish with floral decoration, 9 ľ" dia
Ł100-150

4. A Royal Worcester oviform two handle vase with peacock
decoration on an apple green ground, by Sedgley, 8" high (small
chips) Ł100-150
etc, etc.

The code is as follows
Option Explicit
Public numbera, numberb, numberc, numberd, numberend As Integer
Public extranumbers, nextLotString, CategoryString, auctionname,
auctionnameman As String
Public auctiondate As Date, SaturdayAuctionDate As Date
Public Daystring, Monthstring, Yearstring, finaldate
Public Prompt, Category, testfile, filestring, newfilename

Sub Catalogue1()
'
' catalogue1 Macro
' Macro Created by Gerard Alan Latham (ops) 05/05/98
'
' Get the name of the current auction and open.
'
Prompt = " Enter Current Auction Name (eg WA130598)"
auctionname = InputBox$(Prompt)
If auctionname = "" Then
Exit Sub
Else
auctionnameman = "c:\My documents\simmons\catalogue\" +
auctionname + ".man"
testfile = Dir(auctionnameman)
If Len(testfile) = 0 Then
MsgBox "The File " + auctionnameman + " does not exist"
Exit Sub
End If
Documents.Open FileName:=auctionnameman
End If
'
' Set up page
' Go to first line
'
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = InchesToPoints(0.79)
.BottomMargin = InchesToPoints(0.79)
.LeftMargin = InchesToPoints(1)
.RightMargin = InchesToPoints(0.6)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.49)
.FooterDistance = InchesToPoints(0.63)
.PageWidth = InchesToPoints(8.27)
.PageHeight = InchesToPoints(11.69)
End With
Selection.Document.Kind = wdDocumentNotSpecified
Selection.Range.AutoFormat
Selection.WholeStory
Selection.Font.Name = "Times New Roman"
Selection.Font.Size = 12
With Selection.ParagraphFormat
.LeftIndent = InchesToPoints(0.5)
.RightIndent = InchesToPoints(0)
.SpaceBefore = 12
.Alignment = wdAlignParagraphJustify
.WidowControl = True
.FirstLineIndent = InchesToPoints(-0.5)
.OutlineLevel = wdOutlineLevelBodyText
End With
Selection.HomeKey Unit:=wdStory
'
' Change all # chrs to Ł chrs
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "#"
.Replacement.Text = "Ł"
.Forward = True
.Wrap = wdFindAsk
End With
Selection.Find.Execute Replace:=wdReplaceAll
'
' Insert page numbers
' Go to first line
'
With Selection.Sections(1).Headers(1).PageNumbers
.NumberStyle = wdPageNumberStyleArabic
.HeadingLevelForChapter = 0
.IncludeChapterNumber = False
.ChapterPageSeparator = wdSeparatorHyphen
.RestartNumberingAtSection = False
.StartingNumber = 0
End With
Selection.Sections(1).Footers(1).PageNumbers.Add
PageNumberAlignment:= _
wdAlignPageNumberCenter, FirstPage:=True
Selection.HomeKey Unit:=wdStory
'
' Remove all double spacing.
' Go to first line
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = " "
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
End With
Selection.HomeKey Unit:=wdStory
'
' Change all hyphens to non separating.
' Go to first line
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "-"
.Replacement.Text = "^~"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
'
' Find the Ł, and put 6 spaces in front of it.
' Go to first line
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "Ł"
.Replacement.Text = " Ł"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.HomeKey Unit:=wdStory
'
' Find the Ł, extend to end of line,italicise,
' put cursor after Ł and do until no more Ł. Go to first line
'
Selection.Find.ClearFormatting
With Selection.Find.Font
.Bold = False
.Italic = False
End With
Selection.Find.Text = "Ł"
Selection.Find.Execute
Do While Selection.Find.Found
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Font.Italic = wdToggle
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find.Execute
Loop
Selection.HomeKey Unit:=wdStory
checknumbers
End Sub

Public Sub checknumbers()
'
' checknumbers Macro
' Macro Created by Gerard Alan Latham 10/05/98
'
' Go to the end and find the last number (=numberend)
Selection.EndKey Unit:=wdStory
Selection.MoveUp Unit:=wdParagraph, Count:=1
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
numberend = Selection.Text
' Go to start
Selection.HomeKey Unit:=wdStory
' Select the first number (= numbera), Select 2nd number(=numberb)
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
numbera = Selection.Text
numberb = 0
Beep
Do While numberb < numberend
Selection.MoveDown Unit:=wdParagraph, Count:=1
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
numberb = Selection.Text
numberc = numberb - numbera
If numberc = 1 Then
numbera = numberb
ElseIf numberc > 1 Then
numberd = numbera + (numberc - 1)
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.TypeParagraph
Selection.MoveUp Unit:=wdLine, Count:=1
extranumbers = (numbera + 1) & "-" & (numberd) & "."
Selection.TypeText Text:=extranumbers
Selection.MoveDown Unit:=wdParagraph, Count:=1
Selection.InsertBreak Type:=wdPageBreak
Selection.TypeParagraph
Selection.MoveDown Unit:=wdParagraph, Count:=1, Extend:=wdExtend
nextLotString = Selection.Text
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.TypeParagraph
CategorySelection
Selection.Font.Bold = wdToggle
Selection.Font.AllCaps = wdToggle
Selection.TypeText Text:=CategoryString
numbera = numberb
End If
Loop
Selection.HomeKey Unit:=wdStory
Selection.TypeParagraph
Selection.TypeParagraph
topheader
SaveFile
MsgBox "Procedures Complete, Now do spelling check"
End Sub

Public Sub topheader()
'
' topheader Macro
' Macro Created by Gerard Alan Latham 10/05/98
'
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.Font.Bold = wdToggle
Selection.TypeText Text:="CERAMICS AND GLASS"
Selection.HomeKey Unit:=wdStory
End Sub

Public Sub SaveFile()
'
' Savefile Macro
' Macro Created by Gerard Alan Latham 12/05/98
newfilename = auctionname + ".doc"
MsgBox "Filed as: " & newfilename
ActiveDocument.SaveAs FileName:=newfilename,
fileformat:=wdFormatDocument
End Sub

Public Sub CategorySelection()
Load CategorySelectionForm
CategorySelectionForm.Show
End Sub

Public Sub TimeGames()
Daystring = Mid(auctionname, 3, 2)
Monthstring = Mid(auctionname, 5, 2)
Yearstring = Mid(auctionname, 7, 2)
auctiondate = DateSerial(Yearstring, Monthstring, Daystring)
SaturdayAuctionDate = DateAdd("d", 3, auctiondate)
End Sub

John McGhie

unread,
Jun 7, 1998, 3:00:00 AM6/7/98
to

On Mon, 1 Jun 1998 02:25:07 -0700 , Gerard Alan Latham
<Ger...@galatham.demon.co.uk> wrote:


>Can anyone tell me how to fix this, please.

>Word 97
>I have written a macro to format a txt document. It works fine on my
>machine but when I copy the normal.dot file to another machine (where it
>was to function) the hanging indents are not in a straight line down the
>page.
>

Yes, Gerard:

With Word 97, the bullets and numbering formatting is stored in the
registry of the individal machine, not in the document, and not in
either template.

To overcome this, you need to write a macro to perform the formatting,
place the macro on a toolbar button, and distribute it to everyone's
computer.

Before you read any further, let me warn you: my method peremptorily
overwrites the users' bullet templates. In my situation (large
corporate customers whith strict formatting specifications) this is
"almost" a benefit, since my formats are the only ones they want to
use in these types of documents. They can use any formats they like
in other documents.

Now, I assume Gerard that you are relatively familar with Visual Basic
for Applications. However, many of us aren't, so I have included a
full explanation for those who want it. It's a faily "full"
explanation, which may be a lot more than you need. I just wish
someone had sent it to *me* six months ago :-)

Like many others around the world, I am still feeling my way around
the new bullets and numbering engine in Word 97. It is important to
understand that it is a new slab of code that emulates the
"appearance" of the bullets and numbering in the four previous
versions of Word, but actually works nothing like them. This message
simply shares what I have learned so far, and implemented for two of
my customers. This is a major issue for technical writing consultants
such as myself who use lots of bullets and numbering, so I would
welcome comments from others who have got further along this road.

Here's a macro which I wrote for one of my customers that applys a
bulletted list that never varies from machine to machine:

Sub ApplyFormattedBullets()
'
' ApplyFormattedBullets Macro
' Macro recorded 05/10/98 by John McGhie
'
Application.ScreenUpdating = False

With ListGalleries(wdBulletGallery).ListTemplates(1).ListLevels(1)
.NumberFormat = Chr(183)
.TrailingCharacter = wdTrailingTab
.NumberStyle = wdListNumberStyleBullet
.NumberPosition = 90
.Alignment = wdListLevelAlignLeft
.TextPosition = 102.25
.TabPosition = 102.25
.ResetOnHigher = True
.StartAt = 1
With .Font
.Size = 9
.Name = "Symbol"
End With
.LinkedStyle = "Formatted_Main"
End With

Selection.Style = ActiveDocument.Styles("Formatted_Main")

ListGalleries(wdBulletGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplate
ListTemplate:=ListGalleries( _
wdBulletGallery).ListTemplates(1),
ContinuePreviousList:=False, ApplyTo:= _
wdListApplyToSelection

Application.ScreenUpdating = True

End Sub


Let's go through the code:

You note that the comment says the macro was "recorded" by me? Well,
that's exactly how it started, and that's the easiest way to make one
of these. You simply turn the macro recorder on, format a bulletted
list, then turn it off again.

If you are like me, you then trim down the resulting huge slab of code
so that it only sets the specific parameters you are interested in.

The first line turns Screen Updating off. Visual Basic is very slow
(at least, it is on a Pentium II-300 with 64 MB of memory :-)) One
trick to speed things up is to turn off screen updating so that Word
does not have to stop and update the screen between every command. To
show that I have been properly house-trained, I turn it back on as the
last line in the program. No sense in advertising the fact that I am
lazy :-)

Now we come to the first "With" statement. A "With" statement is a
shorthand way of writing commands that update several properties of
the same object. It makes the code easier to read. It does not
affect the running time, so you could use an individual statement for
each property if you wanted to.

The statement "With
ListGalleries(wdBulletGallery).ListTemplates(1).ListLevels(1)" is
actually setting up a list template that I intend to apply later. It
doesn't apply it, it just sets it up.

A moment's digression to explain how this works, then you will
understand why I did it this way. In Word 97, the formatting of the
BULLETS is stored in the "List Template". The List Template is stored
in the registry of the machine that wrote the bullets. (I think I
have that right...)

The formatting of the PARAGRAPH is stored in the style. The style is
stored in both the document and the template, and there can be
different versions of it in each. If you use only the Normal style in
a document, then the formatting is stored in the paragraph, and every
paragraph can be different.

Unfortunately, in Word 97, the bullets formatting and the paragraph
formatting have some common elements: the left margin, the indent, the
hanging indent, and the tab position. The bullets and numbering
settings either re-set the paragraph settings to zero (the margins)
over-write them (the indents) or add to them (the tabs...) This can
get really confusing.

So I should have warned you that to make this solution work, you must
first REMOVE the bullets formatting from the style. This seems to be
an essential step. I will explain why in a moment. But it leads to
endless grief for me, because I have lots of documents coming in from
Word 6 and Word 95 with bullets in the style.

It would appear that in the style, Word 97 stores ONLY the identify of
the list template that was applied to produce the bullets. It does
not store the bullet formatting. So if you get a document that had
bullets in Word 6, it comes in with a style that gets transposed to
"Paragraph one inch indent plus ListBullet Template 1". Now the
original had nice round bullets at the left margin. List template
Bullet 1 on "this" machine has square bullets indented 2.5 cm. All
hell breaks loose. My macro overcomes this, by brute force.

Back to the subject: The ListGalleries statement collects all the
settings for a list template and puts them in memory where we can
write to them. You have to ensure that you pick these properties up
with a ListGalleries statement. If you access the same properties
with other statements, you can read them but not write to them. I
spent hours chasing that particular little gotcha...

Within the list gallery there are three collections, one each for
Bullets, Numbers, and Outline lists. We want the "wdBulletGallery".
This makes sure that we are looking at the collection of bulletted
lists, and that we are looking within Word. There are different sorts
of bulletted lists in other Office applications: we want the Word
format.

Within the Bullets collection, I have chosen List Template number 1.
There are 7. Number 0 is "none". You can choose any templates you
like, but I suggest that you start with number 1, because that is the
template that gets applied if the user simply hits the bullets button
without selecting a format. For this particular customer, I used
templates 1, 2, and 3 to give me round bullets, hyphen bullets, and
check-mark bullets. I suggest that you stay away from the
higher-order numbers, because they get overwritten each time the user
chooses a different format or opens a document that contains one.
This will not affect my macro, since it explicitly overwrites the
users' formatting each time. But it will piss the user off if you
keep blowing away his bullet formats, so I suggest that you adopt a
convention and let the users know what it is. My users know that
their first three formats will get hammered each time they use one of
my documents.

The rest of the with statement specifies only the things I am
interested in having consistent between documents. After each
statement, I have added a ' mark, and a comment to tell you what it
is:

.NumberFormat = Chr(183) 'sets a round bullet
.TrailingCharacter = wdTrailingTab 'allows Word to creat
a tab at the indent position
.NumberStyle = wdListNumberStyleBullet 'specifys a bullet,
not a number
.NumberPosition = 90 'the number position, in points
.Alignment = wdListLevelAlignLeft 'the paragraph alignment
.TextPosition = 102.25 ' Yup! The text position, in points
.TabPosition = 102.25 'And the tab position after the bullet
.ResetOnHigher = True 'Not needed in a bulleted list, I should
have taken it out...
.StartAt = 1 ' Also not needed...
With .Font ' A nested "with" to set the appearance of the
bullet character
.Size = 9 'the bullet size, in points
.Name = "Symbol" 'The font name of the bullet
End With
.LinkedStyle = "Formatted_Main" 'The linked style

OK, some remarks. First: there are many other properties of the list
template and its paragraph I have not set. This is because they are
either set in the style, or because I do not care what they are.

By default, Word's dimensions in this collection are in points. There
are conversion functions that Word will insert automatically if you
record the macro while using a different measurement unit.

Through carelessness, I left two statements in there, ResetOnHigher
and StartAt, which do not apply at all to bulletted lists. They have
no effect, but they do slow the program down, so I should have taken
them out.

In the NumberFormat statement, I used a Chr() function and an ANSI
character code, rather than the default CharW() function and a Unicode
character code. This is simply for backwards compatibility. If the
document is ever downgraded to a Word 6 or Word 2 document, or out to
WordPerfect, I do not want the bullet suddenly turning into some
strange character because they do not understand Unicode. You can
usually tell if Word has inserted a Unicode character: the character
code will be much greater than 255 :-)

I set the trailing character to a tab. This places a physical tab
character after the bullet, without which the indent will dissappear
if the document is converted to Windows Help format.

The NumberStyle statement is what actually makes this a bulletted
list, If this were set differently, Word would print a number in the
bullet position.

The NumberPosition statement specifies the position of the bullet, in
points, from the left margin of the page. Be careful: this dimension
is returned differently from the Paragraph collection, as a negative
first-line indent.

TextPosition and TabPosition set the left margin of the text after the
bullet. They should match. In your problem document, if you looked
at these properties, you would find that they are different, which is
what actually caused your problem :-)

The "LinkedStyle" statement is optional and important. It sets the
indents we have specified into the local copy of the style (the one in
the document). In this case, the ONLY place I am going to use this
formatting is for this type of list, and it will ALWAYS have this
style, so I can link it. There are other cases where I have two or
three different styles for a list (for example, one for the first
paragraph, one for the middle paragraphs, and one for the last
paragraph). In those cases, I *can't* use a linked style, otherwise
every time I use the list template, I change the style. Here, that's
what I want.

The next statement Selection.Style =
ActiveDocument.Styles("Formatted_Main") applies the style to the
selection. I could have added this as a parameter to the previous
statement, but I chose to do it as a separate statement for reasons
that I have forgotten...

The next statement
ListGalleries(wdBulletGallery).ListTemplates(1).Name = ""
Selection.Range.ListFormat.ApplyListTemplate
actually applies the list template that we have set up to the
selection.

The next statement, ListTemplate:=ListGalleries( _
wdBulletGallery).ListTemplates(1),
ContinuePreviousList:=False, ApplyTo:= _
wdListApplyToSelection
does two things: it creates this as a new list, and makes sure that
this list extends only to the limits of the selection.

In Word 97, there can be many lists in the document.

Each of these lists can have one or multiple sections.

The sections of two or more different lists can be interspersed.

This behaviour confuses the shit out of users later: they make a
change to the bulleted list on page 19, and the bullets on pages
three, four, and 21 change in sympathy, whereas the rest of the
bullets in the document do not. They're members of a different list.
I code my macros to avoid this.

The "ContinuePreviousList parameter explicitly ends any previous list
that may have been used before this one (the default is to continue
the exiting list and create this new series of bullets as a member of
it). The ApplyTo parameter makes sure that this application does not
affect any other lists in the document.

Note that I had to explicitly specify which list template I used.
Many coders set this into a variable so they get it consistent
throughout their code.

There you go: I hope this helps.


John McGhie <jo...@mcghie-information.com.au>
Consultant Technical Writer
McGhie Information Engineering Pty Ltd
Sydney, Australia (GMT +10 hrs) +61 (02) 9626 1048

John McGhie

unread,
Jun 7, 1998, 3:00:00 AM6/7/98
to

Hi Gerard:

On Fri, 5 Jun 1998 23:26:10 +0200 , Gerard Alan Latham
<Ger...@galatham.demon.co.uk> wrote:

>In article <VA.00000848.0092e609@default>, Cindy Meister -WordMVP-
><CindyM...@compuserve.com> writes
>>Hi Gerard,
>>
>>> I have written a macro to format a txt document.
>>>
>>Could you copy/paste the macro code to a message - then we might be
>>able to see something more...
>My apologies to all as this seems rather long. Please also note that
>this is my first attempt at VBA.

I wish *my* first attempt at VBA had been as impressive :-)

My comment would be that you seem to be applying "typewrite-style"
formatting. This is forcing Word to work in a manner opposite to the
way it was designed. Have I missed something here?

You may want to change your approach to let Word do proper formatting.
It has built-in automatic features to do this for you. I think you
might get a quicker, more stable result, with a lot less code.

> Prompt = " Enter Current Auction Name (eg WA130598)"

You could pre-fill the FileOpen Word dialog box, then throw it on
screen user's face and let him pick a file.

>' Set up page

No. don't bother. Create a template with the correct dimensions and
styles. Create a document from it and copy the text into it. It's a
hell of a lot simpler.

>' Insert page numbers

Don't need this: set and format the page numbering in the template.

>' Find the £, and put 6 spaces in front of it.

Do not use spaces to position things in proportional text: they change
width and stuff wanders around. If you are going out to HTML, use
non-breaking spaces, otherwise, use tabs or tables to line things up.

>checknumbers
>End Sub
>
>Public Sub checknumbers()


I think you are writing numbers into the text? With an explicit
paragraph mark as a line-end on each line? Why?

Why do you not create a numbered list with a hanging indent?

Something like:

Selection.Range.ListFormat.ApplyListTemplate
ListTemplate:=ListGalleries(wdNumberGallery).ListTemplates(1),
ContinuePreviousList:=FormattedContinue, ApplyTo:= _
wdListApplyToWholeList

Does it in one statement.

>' topheader Macro

I wouldn't do it that way.

You could make an Autotext in the template to contain a correctly
formatted example and simply copy it in, or if you want it dynamic,
create styles for te formatting and print variables into the text.
You also do not seem to be positioning the insertion point in the
header to do this, are you?

Hope this helps.

Gerard Alan Latham

unread,
Jun 7, 1998, 3:00:00 AM6/7/98
to

In article <3581a443...@msnews.microsoft.com>, John McGhie
<jo...@mcghie-information.com.au> writes

>My comment would be that you seem to be applying "typewrite-style"
>formatting. This is forcing Word to work in a manner opposite to the
>way it was designed. Have I missed something here?

Firstly may I say thank you for both your posts on this topic; it will
take me sometime to work my way through them. Lots of snips follow.

I do not think you have <missed something>, I just went ahead and tried
to work something out to make my wife's work easier. I wonder if I
should take this to email as these posts are somewhat lengthy and I am
not sure how many other subscribers are interested in this VBA newbies
problems, however...

>You could pre-fill the FileOpen Word dialog box, then throw it on
>screen user's face and let him pick a file.

Will try it, I have, as yet, not found this dialog box.

>>Public Sub checknumbers()
>
>
>I think you are writing numbers into the text? With an explicit
>paragraph mark as a line-end on each line? Why?

The original text comes from an auction program which downloads a text
file with the numbers already in. At the end of each category some
numbers are missed before the next category starts. this allows for
extra lots to be put in the catalogue at the end of each category.
checknumbers() searches for missing numbers in the sequence, write them
in as blank lot numbers ( 189-193 for example) and then calls up a user
form where the next filled lot is displayed and the next category
heading can be <clicked> in or written in.

>>' topheader Macro
>
>I wouldn't do it that way.

The first category in the auction catalogue is <always> CERAMICS AND
GLASS so I just stuck that in like that; other categories change so when
a break in the sequence of numbers appears that means another category
is starting and the user form (which I did not post the code for)
appears with choices or a write in.
>
>Hope this helps.

Indeed it does but it looks like I am going to have to do a lot of
reading :-)

Cindy Meister -WordMVP-

unread,
Jun 8, 1998, 3:00:00 AM6/8/98
to

Hi Gerard,

> The form of the original text file *.man is:
>

Try selecting this text, then run Format/AutoFormat over it. Does that
give you something closer to what you'd like to have - without having
to program it yourself?

Gerard Alan Latham

unread,
Jun 9, 1998, 3:00:00 AM6/9/98
to

In article <VA.00000885.0123a970@default>, Cindy Meister -WordMVP-
<CindyM...@compuserve.com> writes
>Hi Gerard,
>

>> The form of the original text file *.man is:
>>
>Try selecting this text, then run Format/AutoFormat over it. Does that
>give you something closer to what you'd like to have - without having
>to program it yourself?

Have just tried and no, it does not give anything like the required
result.

Many thanks for the reply.

Gerard Alan Latham

unread,
Jun 9, 1998, 3:00:00 AM6/9/98
to
>>' Find the £, and put 6 spaces in front of it.
>
>Do not use spaces to position things in proportional text: they change
>width and stuff wanders around.

I have now tried using a tab. :-(
The problem with using tabs is that I want the estimates (UKPsign
followed by two numbers separated by a hyphen) to be some way from the
end of the description of the lot. If I use a tab then, in some cases
the next tab stop is only a short (one character) distance from the
description end. If I use spaces then the estimate is separated every
time by a reasonable distance; however, that distance does not have to
be exact each time.

John McGhie

unread,
Jun 9, 1998, 3:00:00 AM6/9/98
to

Use a Style for the paragraph, and *set* the position of the tab in
the style. You do not have to rely on Word's default tabs (in fact,
when programming you should ALWAYS explicitly set tabs, since users
can and do change their default tab interval).

I recorded the following macro straight off the keyboard...


Sub trash()
'
' trash Macro
' Macro recorded 06/10/98 by John McGhie
'
With ActiveDocument.Styles("Body Text")
.AutomaticallyUpdate = False
.BaseStyle = "Normal"
.NextParagraphStyle = "Body Text"
End With
ActiveDocument.Styles("Body
Text").ParagraphFormat.TabStops.ClearAll
ActiveDocument.Styles("Body Text").ParagraphFormat.TabStops.Add
Position:= _
108, Alignment:=wdAlignTabLeft, Leader:=wdTabLeaderSpaces
Selection.Style = ActiveDocument.Styles("Body Text")
End Sub


Cheers.

Gerard Alan Latham

unread,
Jun 9, 1998, 3:00:00 AM6/9/98
to

In article <357f4076...@msnews.microsoft.com>, John McGhie
<jo...@mcghie-information.com.au> writes

>Use a Style for the paragraph, and *set* the position of the tab in
>the style. You do not have to rely on Word's default tabs (in fact,
>when programming you should ALWAYS explicitly set tabs, since users
>can and do change their default tab interval).

Agreed, but perhaps I did not explain the problem well. The position of
the estimate of the lot is to follow the description of the lot by some
distance. Lot descriptions may be one line or several in length and will
vary in total length, thus the end of the description may be anywhere
along the last line of the description. I would have to ascertain the
position of the end of the description and then add a tab stop about 6
spaces after that for each lot... there are usually over 1000 lots.
example:

1. A Victorian armchair. £10-20

2. A Sheraton bow legged table with long legs and a round top which
then wraps round. £200-300
.
.
.
1053. A....
etc
The position of the estimate is required relative to the end of the
description, not relative to the LHS of the page.

Doug Robbins

unread,
Jun 10, 1998, 3:00:00 AM6/10/98
to

Hi Gerard,

Instead of using spaces or tabs, you should be able to do what you want by
inserting an {ADVANCE \r #} field where # is the space in points that you
want between the end of the description and the estimate.

The command for doing this via VBA is

Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:=
_
"ADVANCE \r #", PreserveFormatting:=False

Hope this helps

Regards,

Doug Robbins - Word MVP

Gerard Alan Latham wrote in message ...

Gerard Alan Latham

unread,
Jun 11, 1998, 3:00:00 AM6/11/98
to

In article <e5fzaJG...@uppssnewspub04.moswest.msn.net>, Doug Robbins
<doug_r...@email.msn.com> writes

>Instead of using spaces or tabs, you should be able to do what you want by
>inserting an {ADVANCE \r #} field.....
[snips]

Thanks Doug, I will try this. However, the six spaces work and are not
really the problem which was a ragged hanging indent when transferring the
macro to another machine.

0 new messages