How to automatically Hide Field Code spaces After using them in MS

P

PetruDov

Gentleman,
I am using MS word 97/2000
I have a MS Word document that contains certain text and a group of Field
codes in diffeerent locations in the same document. Once I run (update) the
field codes, they calculate and insert results in other different places.
Once I "run the form" or updated the field codes, I have to obtain the Final
simple output document for a client, where he need not know any thing about
field codes nor about a group of text notes in the document, let me call the
the Net output desired document.
I ran the field codes and then Unlink them, with a Macro, all of which works
fine.
Once I unlink the field codes it leaves a group of empty or Blank spaces is
several locations which I must remove in order to obtain the final Net
document.
My Question is: How to remove these blank lines left from the Unlinked Field
codes Automatically without a manual process, perhaps some more additions to
my Macro, or by running another Macro to remove these blank spaces. Ofcourse
I do not need these blank spaces only in the final Printed output.
So, I tried to Hide the field codes, then I Show them with the Paragraph
Mark, then I ran my Macro on all the document etc.
I found that If the Field codes are hidden like that, they do Not update
correctly some expected results into some fields, and they miss others
completely. But exact same form works correct if the field codes are not
hidden. But I do get the ability to hide the blank spaces after unlinking the
field codes...
I hope I defined the problem. I would like to know if am I on the right
direction by trying to Hide the Field codes before Updating and Unlinking, or
is there some another simple way and/or Macro that I could run to Remove
Blank Lines in order to obtain the final Net document automatically as much
as possible?
I thank you for any help and advice!
Peter
 
C

Cindy M -WordMVP-

Hi Petru,

Can you describe what kinds of fields are leaving blank spaces? Would your code
be able to determine, based on the Field.Result, whether a field will leave an
undesired blank space?

If yes, then it might work to first loop through all the fields and delete those
that will cause the problem, then unlink the rest.

Or, if the blank space is always the same set of characters (two or three
consecutive space characters, for example) you could use find/replace to remove
them after unlinking the fields?
I am using MS word 97/2000
I have a MS Word document that contains certain text and a group of Field
codes in diffeerent locations in the same document. Once I run (update) the
field codes, they calculate and insert results in other different places.
Once I "run the form" or updated the field codes, I have to obtain the Final
simple output document for a client, where he need not know any thing about
field codes nor about a group of text notes in the document, let me call the
the Net output desired document.
I ran the field codes and then Unlink them, with a Macro, all of which works
fine.
Once I unlink the field codes it leaves a group of empty or Blank spaces is
several locations which I must remove in order to obtain the final Net
document.
My Question is: How to remove these blank lines left from the Unlinked Field
codes Automatically without a manual process, perhaps some more additions to
my Macro, or by running another Macro to remove these blank spaces. Ofcourse
I do not need these blank spaces only in the final Printed output.
So, I tried to Hide the field codes, then I Show them with the Paragraph
Mark, then I ran my Macro on all the document etc.
I found that If the Field codes are hidden like that, they do Not update
correctly some expected results into some fields, and they miss others
completely. But exact same form works correct if the field codes are not
hidden. But I do get the ability to hide the blank spaces after unlinking the
field codes...
I hope I defined the problem. I would like to know if am I on the right
direction by trying to Hide the Field codes before Updating and Unlinking, or
is there some another simple way and/or Macro that I could run to Remove
Blank Lines in order to obtain the final Net document automatically as much
as possible?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

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

PetruDov

Hi Cindy,
First I thank you for your reply.
I think the second part of your response is closer to what I need, since the
Blank Spaces are fixed, because they come in allways after Unlinking All the
field codes that were used first to do calculations.
So my question is how to find this Blank Spaces in VBA (Like the chr(10) and
chr(13)) and what to replace them with inorder Not to have Blank spaces. In
another words the algorithm would look anywhere for two or more Blank spaces,
if finds such delete them all Minus one to leave one blank space only. SO how
you do that in VB or may be there is a ready Macro available that does just
that?
I thank you for your help again.
Pete
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?UGV0cnVEb3Y=?=,
So my question is how to find this Blank Spaces in VBA (Like the chr(10) and
chr(13)) and what to replace them with inorder Not to have Blank spaces.
First, you need to figure out exactly what characters these "blank spaces" are.
Under this term, I'd expect real spaces (Chr(32)).

To get started, go into Edit/Find and look at the "special" list, then activate
"Wildcards" (pattern matching) and take another look at the "special" list. You
should be able, using the one or the other mode, to search for 2 or more
characters. Setting replace is simple: just replace with a single character.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

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

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