Convert text to Word

Robie
5StarLounger
Posts: 656
Joined: 18 Feb 2010, 14:26

Convert text to Word

Post by Robie »

Hi

I need to convert incoming text 'stuff' into readable Word. I have done most of it with a macro - lots of code :-(. Anyway, the bit I can't work out it how to reset and indent numbering . For example:

Code: Select all

Title|Displaying multiple Charges
Reference|CTAC00362c, CR24483
Previously, if too many breakdown charges applied to a single allocation the user could not view them all on the Contract Page dialog. Now, scroll bars can be used to display all the available charges.
* Bullet 1
** Bullet L2
*** Bullet L3

# Number
##- Number L2
### Number 3

|col1|col2|
|col1|col2|
|col1|col2|
|col1|col2|

# Number
##- Number L2
### Number 3

has to look like the attachment. Is that possible using a macro?
numberingrestart.png
Thanks.
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert text to Word

Post by HansV »

What is the EXACT criterion for restarting the numbering?
Best wishes,
Hans

Robie
5StarLounger
Posts: 656
Joined: 18 Feb 2010, 14:26

Re: Convert text to Word

Post by Robie »

HansV wrote:What is the EXACT criterion for restarting the numbering?
Interesting question! I think it is basically any other type of paragraph between the last numbering paragraph and we restart the numbering. For example,

# Number 1
# Number 1 again
## Number 2
Some other paragraph, i.e. as long as it doesn't start with a '#'.
# Number 1 (need to restart at the point)
etc

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert text to Word

Post by HansV »

You could declare a boolean variable blnRestart. Loop through the paragraphs, and when you encounter a paragraph that does not begin with #, execute

blnRestart = True

When you encounter a paragraph that starts with a single #, check blnRestart. If it is true, restart the numbering and execute

blnRestart = False

so that the next paragraphs will not restart numbering, until you encounter one that does not start with #.
Best wishes,
Hans

Robie
5StarLounger
Posts: 656
Joined: 18 Feb 2010, 14:26

Re: Convert text to Word

Post by Robie »

HansV wrote:You could declare a boolean variable blnRestart. Loop through the paragraphs, and when you encounter a paragraph that does not begin with #, execute

blnRestart = True

When you encounter a paragraph that starts with a single #, check blnRestart. If it is true, restart the numbering and execute

blnRestart = False

so that the next paragraphs will not restart numbering, until you encounter one that does not start with #.
Thanks Hans. Perhaps, I have not explained it correctly. It's the VBA bit that resets the numbering I am interested in. Perhaps, just point me to the right direction and I will figure it out.

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Convert text to Word

Post by HansV »

Best wishes,
Hans