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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RightJustify Numeric Flds in Word document

Status
Not open for further replies.

EDB2

MIS
Sep 11, 2002
36
US
I'm having a heck of a time getting my numeric fields to right justify in a simple list report. I'm generating a Word document through VB6 and using an ado recordset as my source. I decided not to use DataReports because I'm picking my (Oracle) database at run time and everything I've found for DataReports requires that I specify the database at design time.

I first tried using .SELECTION.TYPETEXT to create the detail lines of the report but the numeric fields were straggling all over the place. I was Formating the fields as "##,##0.0" but it was collapsing the number to the left and I couldn't come up with a way to right align them.

I decided to go to a table instead (which I prefer as it solves my word wrap problem in description fields), but the numeric fields are still left justifying instead of right justifying inside the cell and I can't find any alignment property that seems to work with .CELL. I tried playing around with .LEFTPADDING, trying to subtract the length of the data from the width of the cell to see how much padding I needed, but I can't figure out how to translate the length of the field to points - I tried PicaToPoints as that seemed the closest option but it didn't work. I'm still using FORMAT and the numeric data is still collapsing to the left when there are no digits, the place holders don't seem to be working at all.

I've searched the VB help in Word, the MSN site, and the forums and FAQs here but I haven't been able to come up with anything that works - or rather with anything that I have been able to make work! Any ideas will be greatly appreciated
 
For anyone else who is searching for tips on this same problem, I posted this question over in the Word forum and did get an answer to my problem (thank you TonyJollans!)

.Cell(1,1).Range.ParagraphFormat.Alignment = wdAlignParagraphRight
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top