Recalculating Prices in a word table



Simon
07-09-2005, 11:04 PM
I need to read through a word document (Table)
The table has merged cells for Heading

Part No Description Price
====================
Widgets
A12344 Widget 1 5.99
WA123 Widget 2 6.45

Thinggies
D555 Thinggy 1 12.67
RT6161 Thinngy 2 17.50

I need to produce a Trade Price List
so say I deduct 20% from each value

Can't seem to get the VALUE into a a NUMBER format !!!

Sub Trade()
'
' Calculate Trade Price List
'
Application.ScreenUpdating = False
Dim x As Integer
Dim LastRow As Long 'get used LASTROW
LastRow = ActiveDocument.Tables(1).Rows.Count

For x = 1 To 5 'LastRow
Dim Price As Variant
Dim Trade As Variant
Price = Selection.Tables(1).Rows(x).Cells(3)
Retail = Val(Price) * (1-0.2)
MsgBox (Price & Trade)
Next x

End Sub

TF
07-09-2005, 11:04 PM
Use Excel.

--
Terry Farrell - Word MVP
http://word.mvps.org/

"Simon" <Simon@microsoftforums.com> wrote in message
news:OCpsO2IfFHA.2372@TK2MSFTNGP14.phx.gbl...
:I need to read through a word document (Table)
: The table has merged cells for Heading
:
: Part No Description Price
: ====================
: Widgets
: A12344 Widget 1 5.99
: WA123 Widget 2 6.45
:
: Thinggies
: D555 Thinggy 1 12.67
: RT6161 Thinngy 2 17.50
:
: I need to produce a Trade Price List
: so say I deduct 20% from each value
:
: Can't seem to get the VALUE into a a NUMBER format !!!
:
: Sub Trade()
: '
: ' Calculate Trade Price List
: '
: Application.ScreenUpdating = False
: Dim x As Integer
: Dim LastRow As Long 'get used LASTROW
: LastRow = ActiveDocument.Tables(1).Rows.Count
:
: For x = 1 To 5 'LastRow
: Dim Price As Variant
: Dim Trade As Variant
: Price = Selection.Tables(1).Rows(x).Cells(3)
: Retail = Val(Price) * (1-0.2)
: MsgBox (Price & Trade)
: Next x
:
: End Sub
:
:
:
:


Recalculating Prices in a word table