using macros in Word 2010 to select text RRS feed

  • Question

  • I would like help to create a macro to create a table (as done in MS Word 2010), then select numeric values, then move these selected values into the table, which is an array created earlier by a C++ program.
    Sunday, July 31, 2011 4:18 PM


  • I don't really know what yor are asking so this is just a stab that might get you going:

    Sub ScratchMacro()
    'A quick macro scratch pad created by Greg Maxey
    Dim arrData() As String
    Dim i As Long
    Dim oTbl As Word.Table
    arrData = Split("A|B|C|D|E|F|G|etc.,", "|")
    i = UBound(arrData)
    Set oTbl = ActiveDocument.Tables.Add(Selection.Range, i + 1, 1)
    With oTbl
     For i = 0 To UBound(arrData)
      .Cell(i + 1, 1).Range.Text = arrData(i)
     Next i
    End With
    End Sub

    Greg Maxey Please visit my website at:
    Sunday, July 31, 2011 4:33 PM