Quote Originally Posted by gmayor View Post
The original macro works with a Word table. To extract just the 'Word' after Scheme, see below. It wouldn't be much of a stretach to output to a worksheet rather than a Word table.
Option Explicit

Sub SplitToTable()
Dim oSource As Document
Dim oTarget As Document
Dim oTable As Table
Dim oRow As Row
Dim oRng As Range
Dim sText As String
Dim oCell As Range
Dim i As Long
    'Assign a variable name to the document
    Set oSource = ActiveDocument
    'Save the document (before changes are made to it)
    oSource.Save
    'Open a new document
    Set oTarget = Documents.Add
    'Create a table in that document and name the header row cells
    Set oTable = oTarget.Tables.Add(oTarget.Range, 1, 1)
    oTable.Rows(1).Cells(1).Range.Text = "ID"
    'Set a range to the original document
    Set oRng = oSource.Range
    'Locate the ID text
    With oRng.Find
        Do While .Execute(FindText:="Scheme : ", MatchCase:=True)
            On Error GoTo lbl_Exit
            oRng.End = oRng.Next.Words(1).End
            oRng.Start = oRng.Words.Last.Start
            oTable.Rows.Add
            'Set a variable name to the last row of the table
            Set oRow = oTable.Rows.Last
            'Fill the first cell in the row with the ID text
            oRow.Cells(1).Range.Text = oRng.Text
            oRng.Collapse 0
            'And go round again
        Loop
    End With
    'Close the original document without recording the changes
    oSource.Close 0
lbl_Exit:
    Exit Sub
End Sub

Is it possible to extract six different values from data and define the range also to specify how many characters it has to pick while omitting any tabs or spaces. Sample data is pasted below.
sample is as pasted below:

Mr.XYZ

--------------------------------------------------------------------------------------------------------------------------------

Account Number : 01180600999999 Currency : INDIAN RUPEE Account Balance 66,177.00Dr

Scheme : LA001 Last Rephased on : 07-03-2000 Schedule Number : 01 Interest Liability 0

--------------------------------------------------------------------------------------------------------------------------------

Flow Flow Date of Demand Amount Last Adjust- Amount Adjusted Due Date Days
Type Description Demand ment Date Overdue
--------------------------------------------------------------------------------------------------------------------------------
PRDEM PRINCIPAL DEMAND 07-04-2001 25,000.00 0.00 08-04-2001 5399
INDEM INTEREST DEMAND 17-11-2007 41,177.00 0.00 19-11-2007 2983

--------------------------------------------------------------------------------------------------------------------------------
TOTAL OVERDUE : 66,177.00

--------------------------------------------------------------------------------------------------------------------------------

I need to extract the data typed in bold letters and paste into another excel file in 6 different columns. The spaces are very random after each word. Its not possible to count spaces or tabs as its different for every data set. Can we preapre a single code to extract all 6 parameters from the file?