My code breaks at the section marked in bold. I am using a cell value for the column number of a cell. The cell value is a whole number- I have checked it.
Sub Tasking_Import()
Dim wdApp As Word.Application, wdDoc As Word.Document, ws As Worksheet
Set wdApp = Word.Application
Dim rFoundCell As Range
Dim rStr As String, Ronly As String
If wdApp.Documents.Count > 1 Then
End If
If wdApp.ActiveDocument.Tables.Count < 1 Then
Exit Sub
End If
On Error Resume Next
rStr = wdApp.ActiveDocument.FormFields(22).Range.Text
Ronly = Replace(rStr, Chr(13), Chr(10))
Set rFoundCell = (Columns(2).Find(What:=Extract_Number_from_Text(wdApp.ActiveDocument.FormFields(1).Range.Text), _
LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False))
Cells(rFoundCell.Row, Cells(1, 50).Value).Value = Replace(wdApp.ActiveDocument.FormFields(20).Result, Chr(13), Chr(10))
Cells(rFoundCell.Row, Cells(1, 50).Value + 1).Value = Application.WorksheetFunction.Trim(Ronly)
Cells(rFoundCell.Row, Cells(1, 50).Value + 2).Value = wdApp.ActiveDocument.FormFields(21).Result
Cells(rFoundCell.Row, Cells(1, 50).Value + 3).Value = wdApp.ActiveDocument.FormFields(19).Result