Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Ernie&Bert Ernie&Bert is offline
external usenet poster
 
Posts: 2
Default How do you display 1,000,000 in text.

I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default How do you display 1,000,000 in text.

It seems as if only numbers smaller than or equal to 999,999 can be represented
as cardinal text.

--
Stefan Blom
Microsoft Word MVP
(Message posted via NNTP)



"Ernie&Bert" wrote in message
news
I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default How do you display 1,000,000 in text.


It seems as if only numbers smaller than or equal to 999,999 can be represented
as cardinal text.

--
Stefan Blom
Microsoft Word MVP
(Message posted via NNTP)



"Ernie&Bert" wrote in message
news
I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default How do you display 1,000,000 in text.

Take a look at Graham Mayor's example at
http://www.gmayor.com/formatting_wor...ounts_in_words,
following the paragraph that begins "The method has problems with numbers
over 1 million".

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
"Stefan Blom" wrote in message
...
It seems as if only numbers smaller than or equal to 999,999 can be
represented
as cardinal text.

--
Stefan Blom
Microsoft Word MVP
(Message posted via NNTP)



"Ernie&Bert" wrote in message
news
I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007



  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default How do you display 1,000,000 in text.

Take a look at Graham Mayor's example at
http://www.gmayor.com/formatting_wor...ounts_in_words,
following the paragraph that begins "The method has problems with numbers
over 1 million".

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
"Stefan Blom" wrote in message
...
It seems as if only numbers smaller than or equal to 999,999 can be
represented
as cardinal text.

--
Stefan Blom
Microsoft Word MVP
(Message posted via NNTP)



"Ernie&Bert" wrote in message
news
I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007





  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How do you display 1,000,000 in text.

' a Macro to insert cardtext for numbers up to 999,999.999,999
' Macro created 29/09/99 by Doug Robbins
With Selection.Find
.Text = ","
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute Replace:=wdReplaceAll
numtext$ = Int(Val(Selection.Text))
If Val(numtext$) 1000000 Then
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Val(numtext$) & " \* CardText"
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Fields.Update
ElseIf Len(numtext$) 10 Then
millions = Val(Left(numtext$, Len(numtext$) - 6))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
ElseIf Len(numtext$) 14 Then
billions = Val(Left(numtext$, Len(numtext$) - 9))
millions = Val(Mid(numtext$, Len(billions) + 1, 3))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions) -
Len(billions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & billions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" billion "
Selection.Collapse Direction:=wdCollapseEnd
If millions 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
End If
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
End If



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Ernie&Bert" wrote in message
news
I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007


  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How do you display 1,000,000 in text.

' a Macro to insert cardtext for numbers up to 999,999.999,999
' Macro created 29/09/99 by Doug Robbins
With Selection.Find
.Text = ","
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute Replace:=wdReplaceAll
numtext$ = Int(Val(Selection.Text))
If Val(numtext$) 1000000 Then
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Val(numtext$) & " \* CardText"
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Fields.Update
ElseIf Len(numtext$) 10 Then
millions = Val(Left(numtext$, Len(numtext$) - 6))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
ElseIf Len(numtext$) 14 Then
billions = Val(Left(numtext$, Len(numtext$) - 9))
millions = Val(Mid(numtext$, Len(billions) + 1, 3))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions) -
Len(billions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & billions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" billion "
Selection.Collapse Direction:=wdCollapseEnd
If millions 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
End If
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
End If



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Ernie&Bert" wrote in message
news
I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007


  #8   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default How do you display 1,000,000 in text.

Great!

--
Stefan Blom
Microsoft Word MVP
(Message posted via NNTP)



"Doug Robbins - Word MVP" wrote in message
...
' a Macro to insert cardtext for numbers up to 999,999.999,999
' Macro created 29/09/99 by Doug Robbins
With Selection.Find
.Text = ","
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute Replace:=wdReplaceAll
numtext$ = Int(Val(Selection.Text))
If Val(numtext$) 1000000 Then
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Val(numtext$) & " \* CardText"
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Fields.Update
ElseIf Len(numtext$) 10 Then
millions = Val(Left(numtext$, Len(numtext$) - 6))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
ElseIf Len(numtext$) 14 Then
billions = Val(Left(numtext$, Len(numtext$) - 9))
millions = Val(Mid(numtext$, Len(billions) + 1, 3))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions) -
Len(billions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & billions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" billion "
Selection.Collapse Direction:=wdCollapseEnd
If millions 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
End If
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
End If



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Ernie&Bert" wrote in message
news
I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007




  #9   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default How do you display 1,000,000 in text.


Great!

--
Stefan Blom
Microsoft Word MVP
(Message posted via NNTP)



"Doug Robbins - Word MVP" wrote in message
...
' a Macro to insert cardtext for numbers up to 999,999.999,999
' Macro created 29/09/99 by Doug Robbins
With Selection.Find
.Text = ","
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute Replace:=wdReplaceAll
numtext$ = Int(Val(Selection.Text))
If Val(numtext$) 1000000 Then
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Val(numtext$) & " \* CardText"
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Fields.Update
ElseIf Len(numtext$) 10 Then
millions = Val(Left(numtext$, Len(numtext$) - 6))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
ElseIf Len(numtext$) 14 Then
billions = Val(Left(numtext$, Len(numtext$) - 9))
millions = Val(Mid(numtext$, Len(billions) + 1, 3))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions) -
Len(billions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & billions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" billion "
Selection.Collapse Direction:=wdCollapseEnd
If millions 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
End If
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
End If



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

"Ernie&Bert" wrote in message
news
I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007




  #10   Report Post  
Posted to microsoft.public.word.docmanagement
Zaigham Farooqui Zaigham Farooqui is offline
external usenet poster
 
Posts: 1
Default This is a multi-part message in MIMEformat.------=_NextPart_000_0012_01CAEE06.

Macro was copied from forum and pasted but compile Error: Syntax Error message was given at the following line. What is wrong. I have not used macros in MS Word before this.

Balance = Val(Right(numtext$, Len(numtext$) - Len(millions) -
Len(billions)))

Regards
Zaigham

On Friday, May 07, 2010 3:09 PM Ernie&Bert wrote:


I have tried both DollarText and CardText, but it errors out with the
following message:
Error! Number Cannot Be Represented In Specified Format.

Using Word 2007



On Friday, May 07, 2010 3:26 PM Stefan Blom wrote:


It seems as if only numbers smaller than or equal to 999,999 can be represented
as cardinal text.

--
Stefan Blom
Microsoft Word MVP
(Message posted via NNTP)



On Friday, May 07, 2010 4:57 PM Jay Freedman wrote:


This is a multi-part message in MIME format.

------=_NextPart_000_0012_01CAEE06.6886CE40
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: 7bit

Take a look at Graham Mayor's example at
http://www.gmayor.com/formatting_wor...ounts_in_words,
following the paragraph that begins "The method has problems with numbers
over 1 million".

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
It seems as if only numbers smaller than or equal to 999,999 can be
represented
as cardinal text.

--
Stefan Blom
Microsoft Word MVP
(Message posted via NNTP)





------=_NextPart_000_0012_01CAEE06.6886CE40
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
HTMLHEAD
META content=3D"text/html; charset=3Dwindows-1252" =
http-equiv=3DContent-Type
META name=3DGENERATOR content=3D"MSHTML 8.00.6001.18904"
STYLE/STYLE
/HEAD
BODY bgColor=3D#ffffff
DIVFONT size=3D2 face=3DVerdanaTake a look at Graham Mayor's example =
at A=20
href=3D"http://www.gmayor.com/formatting_word_fields.htm#cash_amounts_in_=
words"http://www.gmayor.com/formatting_wor..._amounts_in_w=
ords/A,=20
following the paragraph that begins "SPAN class=3Dq2FONT size=3D2 =
face=3DArialThe=20
method has problems with numbers over 1 =
million/FONT/SPAN"./FONT/DIV
DIVFONT size=3D2 face=3DVerdanaBR-- BRRegards,BRJay =
FreedmanBRMicrosoft=20
Word MVP        FAQ: A=20
href=3D"http://word.mvps.org"http://word.mvps.org/ABREmail cannot =
be=20
acknowledged; please post all follow-ups to the newsgroup so all may=20
benefit./FONT/DIV
BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; =
PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
DIV"Stefan Blom" <A=20
=
m"StefanBlom@discussio=
ns.microsoft.com/A>=20
wrote in message A=20
=
seems as if only numbers smaller than or equal to 999,999 can be =
represented=20
BRas cardinal text.BRBR-- BRStefan BlomBRMicrosoft Word=20
MVPBR(Message posted via NNTP)BRBRBRBR"Ernie&Bert" =
<A=20
=
t.com"Ernie&Bert@d=
iscussions.microsoft.com/A>=20
wrote in message BRA=20
=
/A...BR>I=20
have tried both DollarText and CardText, but it errors out with =
theBR>=20
following message:BR> Error! Number Cannot Be Represented In =
Specified=20
Format.BR>BR> Using Word 2007 =
BRBR/BLOCKQUOTE/BODY/HTML

------=_NextPart_000_0012_01CAEE06.6886CE40--



On Friday, May 07, 2010 10:15 PM Doug Robbins - Word MVP wrote:


' a Macro to insert cardtext for numbers up to 999,999.999,999
' Macro created 29/09/99 by Doug Robbins
With Selection.Find
.Text = ","
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
End With
Selection.Find.Execute Replace:=wdReplaceAll
numtext$ = Int(Val(Selection.Text))
If Val(numtext$) 1000000 Then
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Val(numtext$) & " \* CardText"
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Fields.Update
ElseIf Len(numtext$) 10 Then
millions = Val(Left(numtext$, Len(numtext$) - 6))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
ElseIf Len(numtext$) 14 Then
billions = Val(Left(numtext$, Len(numtext$) - 9))
millions = Val(Mid(numtext$, Len(billions) + 1, 3))
Balance = Val(Right(numtext$, Len(numtext$) - Len(millions) -
Len(billions)))
Selection.Delete
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & billions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" billion "
Selection.Collapse Direction:=wdCollapseEnd
If millions 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & millions & " \* CardText"
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:=" million "
Selection.Collapse Direction:=wdCollapseEnd
End If
If Balance 0 Then
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
PreserveFormatting:=False
Selection.TypeText Text:="=" & Balance & " \* CardText"
End If
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
ActiveDocument.Fields.Update
End If



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com



On Saturday, May 08, 2010 7:48 AM Stefan Blom wrote:


Great!

--
Stefan Blom
Microsoft Word MVP
(Message posted via NNTP)



Submitted via EggHeadCafe
SQL Operations on a Text File with ADO.NET
http://www.eggheadcafe.com/tutorials...th-adonet.aspx


  #11   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default This is a multi-part message in MIME format.------=_NextPart_000_0012_01CAEE06.

Macro was copied from forum and pasted but compile Error: Syntax Error message was given at the following line. What is wrong. I have not used macros in MS Word before this.

Balance = Val(Right(numtext$, Len(numtext$) - Len(millions) -
Len(billions)))

Regards
Zaigham


Because the macro was posted from software that limits the length of the lines, an unwanted line break was inserted into the code. Those two lines should be one line, like this:

Balance = Val(Right(numtext$, Len(numtext$) - Len(millions) - Len(billions)))

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
last lines of text don't display in text boxes for 1 user David Grana Microsoft Word Help 1 October 7th 08 09:40 AM
Display selected text as white text with black highlight? David Rathert Microsoft Word Help 4 April 29th 07 03:42 AM
How do I display the day of the month using text abcsharon Microsoft Word Help 9 February 8th 07 05:31 PM
Can I display text on startup? Smohrman Microsoft Word Help 1 June 1st 06 05:44 AM
can't edit text-will only display Hoeyboy Microsoft Word Help 1 March 13th 06 12:08 PM


All times are GMT +1. The time now is 04:57 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"