By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,353 Members | 1,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,353 IT Pros & Developers. It's quick & easy.

Line Break in MS Word Doc

P: 49
Can anyone tell me how can i break a line in MS WORD doc thru VB 6.0 application? I'm replacing the field values with the data from the databse in MS WORD doc. One of my field value is ( "Jan tst. 020-4848074 intern\line \line App:\line inst. en progr. quattrovox op bestaande apparatuur.\line \line Infra:\line migratie met nr.beh. van 023-5259966 en 3 msn\line \line Instal:\line 3 x bigel t.b.v. 2 x PC en een tel.tst.\line \line contactpers: Mevr. Boorsma tel. 023-5252700 of 5274110\line klant bevetigen aub\line \line uren en monteur gepland in caps material bst via mast m.g.\line \line kanvas ok\line asn mjn*\line Zie informatie.... opdracht kan afgelast worden iom klant.\line") in which "\line"is there. When i replace the field value in WORD doc the big string comes in one line. But i want that where ever "\line" is there , it should come in new line. I tried various commands like "vbCrLf" and "Chr(13)". But nothing is working. Require help in this. All suggessions are welcome
Mar 5 '07 #1
Share this Question
Share on Google+
3 Replies


vijaydiwakar
100+
P: 579
Can anyone tell me how can i break a line in MS WORD doc thru VB 6.0 application? I'm replacing the field values with the data from the databse in MS WORD doc. One of my field value is ( "Jan tst. 020-4848074 intern\line \line App:\line inst. en progr. quattrovox op bestaande apparatuur.\line \line Infra:\line migratie met nr.beh. van 023-5259966 en 3 msn\line \line Instal:\line 3 x bigel t.b.v. 2 x PC en een tel.tst.\line \line contactpers: Mevr. Boorsma tel. 023-5252700 of 5274110\line klant bevetigen aub\line \line uren en monteur gepland in caps material bst via mast m.g.\line \line kanvas ok\line asn mjn*\line Zie informatie.... opdracht kan afgelast worden iom klant.\line") in which "\line"is there. When i replace the field value in WORD doc the big string comes in one line. But i want that where ever "\line" is there , it should come in new line. I tried various commands like "vbCrLf" and "Chr(13)". But nothing is working. Require help in this. All suggessions are welcome
try to use rich text box there u can feed line and then try to save that in word file
Mar 5 '07 #2

hariharanmca
100+
P: 1,977
Can anyone tell me how can i break a line in MS WORD doc thru VB 6.0 application? I'm replacing the field values with the data from the databse in MS WORD doc. One of my field value is ( "Jan tst. 020-4848074 intern\line \line App:\line inst. en progr. quattrovox op bestaande apparatuur.\line \line Infra:\line migratie met nr.beh. van 023-5259966 en 3 msn\line \line Instal:\line 3 x bigel t.b.v. 2 x PC en een tel.tst.\line \line contactpers: Mevr. Boorsma tel. 023-5252700 of 5274110\line klant bevetigen aub\line \line uren en monteur gepland in caps material bst via mast m.g.\line \line kanvas ok\line asn mjn*\line Zie informatie.... opdracht kan afgelast worden iom klant.\line") in which "\line"is there. When i replace the field value in WORD doc the big string comes in one line. But i want that where ever "\line" is there , it should come in new line. I tried various commands like "vbCrLf" and "Chr(13)". But nothing is working. Require help in this. All suggessions are welcome

i think u may use
Set objWord = CreateObject("Word.Application")
and
Set thisDoc = CreateObject("Word.Document")
so

Code here
------------------
thisDoc.Range.InsertAfter vbcrlf

this will help u
Mar 5 '07 #3

P: 49
The thing is that i'm using Find and Replace method to replace the string to the particula field value in the document. The variable "lsVeldWaarde" gets the value from the database which is the big string. So where to put the code so that each substring inside the big string will come in a new line.

lsVeldWaarde = Replace(lsVeldWaarde, "\line", )
sReplace = lsVeldWaarde

With wrdApp4.ActiveDocument.Application.Selection.Find
.Text = sFind
.Replacement.Text = sReplace
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Mar 6 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.