Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / March 2006

Tip: Looking for answers? Try searching our database.

"Visible" NL

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob - 24 Mar 2006 18:14 GMT
In a document-reformatting macro that basically works, I replace page breaks
with blank lines by using the following:

    With Selection.Find
        .Text = "^m"
        .Replacement.Text = vbCrLf
        (snip - other parameters removed for this note)
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

This works well, except it inserts [NL] (Character10) (represented here by
an asterisk) at the beginning of the following line.

Original:
    End of previous page text.
    ---Page Break---
    Start of next page text...

After macro:
    End of previous page text.
    (Paragraph Symbol)
    *Start of next page text...

I wrote a macro to display the ASCII code for the character; that's how I
found out it is the LineFeed character.  On my computer, this character
looks like a blank space.  On a colleague's computer, it is a box.  In
either case, it kinda messes up the formatting.

Rewriting the macro to replace with vbCr works, but I'm still wondering why,
when using vbCrLf, the character "take up space".  I've used vbCrLf before,
and it doesn't seem to put visible space in a line of text.  Any ideas?

As a follow-on, is the paragraph symbol only Chr(13)?  Doesn't this yield
odd results if I cut and paste into a text document?

Thanks,
Bob
Tony Jollans - 24 Mar 2006 18:43 GMT
As you seem to have worked out, it's the "Lf" out of "vbCrLf". VBA has three
different codes 'new line' for different situations and you should use the
appropriate one. In this situation none of them are appropriate.

Word uses the "Cr" character to *represent* a paragraph mark - it is,
however, only a representation and to get a 'proper' paragraph mark, you
should use Word's built in code of "^p" instead.

--
Enjoy,
Tony

> In a document-reformatting macro that basically works, I replace page breaks
> with blank lines by using the following:
[quoted text clipped - 33 lines]
> Thanks,
> Bob
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.