Hi,
I have some Word VBA code that creates a label document and loops round writing data onto each label. I'm doing a series of TypeText instructions to write lines on the labels, but the trailing newline character inserted by 'the system' on the last line is effectively taking up an extra line on the label which I shall need in the next incarnation of this system. I can go into each label of the completed document and delete it manually, but there are hundreds and that's not an option. I want the code not to put it in in the first place. Here's the code fragment that inserts the text onto each label (after selecting the label cell in the table and doing a With for it):
It then selects the next label, gets new data into the variables, writes it out and repeats until the end..TypeText Text:=stTitle1 & vbCr .TypeText Text:=stTitle2 & vbCr .TypeText Text:=stTeam & vbCr .TypeText Text:="Division " & d% & " " & d% & vbCr .TypeText Text:="Team " & t% & " " & t% & vbCr .TypeText Text:="Round " & r% & " " & r% & vbCr .TypeText Text:="Last date for shooting: " & stRoundDates(r%)
Note that the last TypeText does not have a vbCr at the end. However, one does appear in the finished labels. How do I suppress it?
I'm using Word 2007 under Win7 (Home). The data are extracted from an Excel workbook. These labels are to be stuck onto targets for a shooting competition.
I'm much more used to writing in Excel VBA and this is my first foray into Word VBA, so maybe there's some functionality I am not aware of. Hope someone can help. Please.
Bill