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!

Keeping data format between EXCEL and WORD

Status
Not open for further replies.

WBURKERT

Technical User
May 28, 2010
73
Here's my working code.

I need to make column(3) currency format. I would like an Accounting format (dollar sign on left side of a cell and a two decimal place number to the right) But a Currency format, without any symbol could work too.

Set Goods = docDest.Tables.Add(docDest.Bookmarks("Sec" & s).Range, RowCount, ColCount)
With Goods
'.Range.Style = "Table Simple 1,greenbar"
.Columns(1).Width = InchesToPoints(1)
.Columns(2).Width = InchesToPoints(4)
.Columns(3).Width = InchesToPoints(1)
.Rows(1).Range.Font.Bold = True
.Rows.Alignment = wdAlignRowCenter

End With
For Each oCell In Goods.Range.Cells
StatusBar = "RowCount = " & RowCount & " ; ColCount = " & ColCount & " ; docDest = " & docDest & " ; Bookmark = Sec" & s
oCell.Range.Text = rngWithData.Cells(oCell.RowIndex, oCell.ColumnIndex).Value
Next

Set rngWithData = Nothing
Set Goods = Nothing

Next s
 




Hi,

You do realize that Word is a TEXT based application while Excel is a NUMERIC based application.

Why not simply create the TEXT structure you want in Excel and transfer that? Remember that FORMATS are only what is displayed. The underlying data are just numbers.

Check out the TEXT function.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Code:
...
rngWithData.Columns(3).NumberFormat = "$ #,##0.00"
For Each oCell In Goods.Range.Cells
  oCell.Range.Text = rngWithData.Cells(oCell.RowIndex, oCell.ColumnIndex).Text
Next
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top