ConvertNumbersToText vs Page and Section Breaks

J

joelfinkle

In Word 2002 and 2003 (and I'm assuming earlier versions), the VBA method
ActiveDocument.ConvertNumbersToText
will have incorrect and unpleasant behavior when a numbered paragraph starts
with a section or page break.

After the method executes, the number, converted to text, will be placed
ahead of the page break, e.g.

1. -> -------------Page Break----------------
Introduction

when what you wanted to happen is

-------------Page Break----------------
1. -> Introduction

The root of this problem is that Page and Section Breaks are not their 'own
paragraphs' but reside within other paragraphs (which has all kinds of nasty
traps for the programmer).

This was discovered while developing tools to assist users of Acrobat 5.0
and 6.0. Those versions of Acrobat are able to convert Word Heading styles
into Acrobat bookmarks, but lose the automatic numbering on the bookmarks.
ConvertNumbersToText is the onlly way to solve this issue (aside from
upgrading to 7.0), but creates additional problems.

Joel Finkle
Director, Product Strategy
Image Solutions, Inc.

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...3&dg=microsoft.public.word.application.errors
 
S

Stefan Blom

Apply "Page break before" formatting (Format>Paragraph>Lines and Page
Breaks tab) rather than manual page breaks, before you convert numbers
to text.

--
Stefan Blom
Microsoft Word MVP


in message
In Word 2002 and 2003 (and I'm assuming earlier versions), the VBA method
ActiveDocument.ConvertNumbersToText
will have incorrect and unpleasant behavior when a numbered paragraph starts
with a section or page break.

After the method executes, the number, converted to text, will be placed
ahead of the page break, e.g.

1. -> -------------Page Break----------------
Introduction

when what you wanted to happen is

-------------Page Break----------------
1. -> Introduction

The root of this problem is that Page and Section Breaks are not their 'own
paragraphs' but reside within other paragraphs (which has all kinds of nasty
traps for the programmer).

This was discovered while developing tools to assist users of Acrobat 5.0
and 6.0. Those versions of Acrobat are able to convert Word Heading styles
into Acrobat bookmarks, but lose the automatic numbering on the bookmarks.
ConvertNumbersToText is the onlly way to solve this issue (aside from
upgrading to 7.0), but creates additional problems.

Joel Finkle
Director, Product Strategy
Image Solutions, Inc.

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/office/com...8cd633&dg=microsoft.public.word.application.e
rrors
 
J

joelfinkle

Stefan Blom said:
Apply "Page break before" formatting (Format>Paragraph>Lines and Page
Breaks tab) rather than manual page breaks, before you convert numbers
to text.

A nice sentiment, but (a) I can't control the document authors that decide
to use manual page breaks, and (b) section breaks are even nassssstier, as
you end up with two numbers;

1->:::::::::Section Break:::::::::::::::::;
2->Something Something

and sometimes you really need a section break (e.g. to insert a landscape
page for a wide table).

A wildcard search for ^m finds both page and section breaks (but only if you
use Selection.Find -- a Range.Find doesn't seem to get past the section
break), and looping through .Executes lets me check for the break being on a
numbered paragraph and rearrange it. Messy but effective.
 
S

Stefan Blom

The problem with paragraph formatting across breaks should affect
manual page breaks only, not section breaks. I can't explain why your
experience is different in that respect.

Also, "^m" for "Find what" should only find manual page breaks, not
section breaks. It is possible that this is a (VBA?) bug with your
version of Word, I guess.

I think you'd better ask for help specifically with VBA in a
programming newsgroup. Someone there will probably be able to sort
this out.

--
Stefan Blom
Microsoft Word MVP


in message
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top