Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String with vbCrLf paragraph char fails in Word Table

Status
Not open for further replies.

zollo9999

Programmer
May 12, 2002
95
AU
Hi

My Access Database creates a Word Document using automation.

I'm using the Find.Execute method with ReplaceWith to insert a string where I have a place marker.

Code:
Set objRange = mWordDocument.Content

objRange.Find.Execute FindText:="DateCcbPayableLong", Replacewith:=strDateCcbPayableLong, Replace:=wdReplaceAll

I need to insert a new line, carrage return, or paragraph character in the text.

Normally I use a Chr(13) or vbCr which works
In this case, I need to insert the string (containing new line char) into a cell of a word table, but instead of getting a new line, I just get a little square ([]) indicating an unprintable character.

I've tried other constants such as:
vbCrLf or Chr(13) + Chr(10)
vbCr or Chr(13)
vbLf or Chr(10)
vbNewLine or Chr(13) + Chr(10)
but none of these work.

Does anyone have any ideas?
Thanks





Zollo VBA Developer
[thumbsup]
 
Hi

I've just tried "^p" and it does work in this situation.

If anyone can enlighten me on why "^p" works and the others don't, please post the info here.

thanks


Zollo VBA Developer
[thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top