Word XP Unprintable vbCrLF 
Author Message
 Word XP Unprintable vbCrLF

I have some code that builds strings then uses Find to replace a token
with the string.

s = RS!Facility_Name & vbcrlf
s = s & RS!Facility_Street_Address_1 & vbCrLf
etc.
mff.FACFacilityAddress = s & vbcrlf ' string in a UDT

Later I insert this string into some boiler plate containing the
token:

rng.Execute FindText:="{FACFacilityAddress}",
ReplaceWith:=mff.FACFacilityAddress, Replace:=wdReplaceAll

This works fine in Word97.

The vbcrlf characters show as unprintable (square boxes) in WordXP
instead of paragraphs as in Word97.

Additional hints:

When the token that is relaced resides in a table cell two squares
show.

When the token is in a regular paragraph a paragraph mark and a square
show up.

** ** Any idea how I can build strings with Paragraph Marks within
strings in WordXP?



Mon, 31 Jan 2005 01:22:06 GMT  
 Word XP Unprintable vbCrLF
In stead of vbCrLf you can also use Chr$(13)


Quote:
> I have some code that builds strings then uses Find to replace a token
> with the string.

> s = RS!Facility_Name & vbcrlf
> s = s & RS!Facility_Street_Address_1 & vbCrLf
> etc.
> mff.FACFacilityAddress = s & vbcrlf ' string in a UDT

> Later I insert this string into some boiler plate containing the
> token:

> rng.Execute FindText:="{FACFacilityAddress}",
> ReplaceWith:=mff.FACFacilityAddress, Replace:=wdReplaceAll

> This works fine in Word97.

> The vbcrlf characters show as unprintable (square boxes) in WordXP
> instead of paragraphs as in Word97.

> Additional hints:

> When the token that is relaced resides in a table cell two squares
> show.

> When the token is in a regular paragraph a paragraph mark and a square
> show up.

> ** ** Any idea how I can build strings with Paragraph Marks within
> strings in WordXP?



Mon, 31 Jan 2005 01:29:52 GMT  
 Word XP Unprintable vbCrLF
Hi Bob,

Quote:
> This works fine in Word97.

> The vbcrlf characters show as unprintable (square boxes) in WordXP
> instead of paragraphs as in Word97.

Basically, you should use vbCR (without the LF) for all versions of
Word...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister
http://www.mvps.org/word
http://go.compuserve.com/MSOfficeForum

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



Mon, 31 Jan 2005 15:07:15 GMT  
 Word XP Unprintable vbCrLF
Yes I tried all the variations suggested (vbCr, chr(13)) but I still
had the unprintable character showing in table text.

Here is the solution I am trying now:

    Set rng = ActiveDocument.Content
    with rng.find
    ....
    .Execute FindText:="^013", ReplaceWith:="^p",
Replace:=wdReplaceAll
    end with

Seems to do the trick.



Tue, 01 Feb 2005 07:33:08 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. vbcrlf or vbCrLf

2. Automating Excel XP from Word XP

3. Word XP and Access XP

4. Word Templates with VBA code running very slow in Word XP

5. Office XP only: Spurious bookmark added to Word document Automating Powerpoint from Word

6. Word 97 Macros > Word XP Macros

7. Retrieving Word XP Metadata from a Word 97 document

8. Word XP Template Error on Word 97

9. VBA - Word 97 to Word XP

10. Word 2000 addin runs but is sometimes silently disabled in Word XP

11. Word automation through Access XP

12. code to open word in acess xp

 

 
Powered by phpBB® Forum Software