Add formula to table using VB6

I am trying to enter a SUM formula to a table in a Microsoft word document using VB6.  Does anyone know the syntax for doing that?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:
Don't know specifically about VB6 but here's an example of how to do it in VBA, the syntax should be pretty similar.
Dim wdApp As Object
Dim wdDoc As Object
Dim wdTbl As Object
Dim wdCell As Object
Dim wdTblCl As Object
Dim I As Long

    Set wdApp = CreateObject("Word.Application")
    wdApp.Visible = True
    Set wdDoc = wdApp.Documents.Add
    Set wdTbl = wdDoc.Tables.Add(wdDoc.Range(0, 0), 3, 3)
    With wdTbl
        .Borders.OutsideLineStyle = 1 ' wdLineStylesingle
        .Borders.InsideLineStyle = 1 '
        For I = 1 To .Rows.Count - 1
            For Each wdTblCl In .Rows(I).Cells
                wdTblCl.Range.InsertAfter Int(Rnd * 100) + 10
            Next wdTblCl
        Next I

        For Each wdTblCl In .Rows(I).Cells
            wdTblCl.Formula Formula:="=SUM(Above)"
        Next wdTblCl
    End With
    Set wdDoc = Nothing
    Set wdApp = Nothing

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
al4629740Author Commented:
I used the following, but to no avail

oTable.Cell(18, 2).Formula Formula:="SUM(Above)"
NorieAnalyst Assistant Commented:
You appear to be missing the = before SUM.
 oTable.Cell(18, 2).Formula Formula:="=SUM(Above)"

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.