vb script microsoft word table cell: inject flush left dollar sign

How can I change this code so that ther is a flush left $ sign in the table cell as in the screenshot:

dim myval
myval = 19298888
tbl.cell(2,9).range.text= FormatNumber(myval)

Screenshot: http://www.screencast.com/t/te3vRJMd0
maxdbaseAsked:
Who is Participating?
 
GrahamSkanRetiredCommented:
Ah, I see. In that case Subodh Tiwari has the right idea, but you need  a right-justified tabstop at the right hand end of the cell:
    With tbl.Cell(2, 9)
        .Range.Text = "$" & vbTab & FormatNumber(myval)
        .Range.ParagraphFormat.TabStops.Add Position:=cl.Width - .RightPadding - .LeftPadding _
            , Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
    End With
0
 
GrahamSkanRetiredCommented:
Have you tried

tbl.cell(2,9).range.text= "$" & FormatNumber(myval)

Open in new window

0
 
maxdbaseAuthor Commented:
No, I will try it.
Will it make the $ flush left and the FormatNumber(myval) flush right?
I think I need something in between that will do that.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
maxdbaseAuthor Commented:
May be if I can inject a tab?  But how?
http://www.screencast.com/t/0Awum4A0TW
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Have you tried something like this?
tbl.cell(2, 9).Range.Text = FormatCurrency(myval)

Open in new window

0
 
maxdbaseAuthor Commented:
FormatCurrency would work if I could make the $ flush left and the number flush right.
0
 
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You may also try something like below to see if that works for you...

tbl.Cell(2, 9).Range.Text = "$" & vbTab & FormatNumber(myval)

Open in new window

0
 
maxdbaseAuthor Commented:
You both rock.  I was stuck on this and your help really made a difference!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.