Hi Guys
Let me first say I am not an advanced user with VBA but have always seemed to get along by trial and error but this week I have come undone and would be grateful for some help.
Here is the background. I have a spreadsheet with 1,500 rows that link to Parent Reports that out teachers' have done in Word Documents. Normally it is an administrators job to check all these and see if a teacher has left any cells blank in the tables within the document, meaning that it is incomplete - a horrible job but a necessary job.
I've been working with some code from here:Detect whether a table cell is empty
So far I have been able to get to the point when Excel opens the word document but it all unravels there. Also I get the error "The remote server machine does not exist or isn't available"
Any help would be greatly appreciated and of course let me know if you need more information
******
Sub ThemeBlankBox()
Dim Path As String
Dim objDoc As Word.Document
Dim objWord As Word.Application
Dim oCell As cell
Dim oRow As Row
Sheets("Data").Select
FinalRow = Range("A9999").End(xlUp).Row
For I = 2 To FinalRow
Path = Sheets("Data").Range("H" & I).Text
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(Path)
objWord.Visible = True
With objDoc
For Each oRow In ActiveDocument.Tables(1).Rows ' this is where the error appears when running line by line (F8)
For Each oCell In oRow.Cells
If oCell.Range.Text = Chr(13) & Chr(7) Then
Range("K" & I).Value = "Empty Cells Present"
Else
Range("K" & I).Value = "Complete"
End If
Next oCell
Next oRow
End With
Next I
objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
objWord.Quit
End Sub
****
Let me first say I am not an advanced user with VBA but have always seemed to get along by trial and error but this week I have come undone and would be grateful for some help.
Here is the background. I have a spreadsheet with 1,500 rows that link to Parent Reports that out teachers' have done in Word Documents. Normally it is an administrators job to check all these and see if a teacher has left any cells blank in the tables within the document, meaning that it is incomplete - a horrible job but a necessary job.
I've been working with some code from here:Detect whether a table cell is empty
So far I have been able to get to the point when Excel opens the word document but it all unravels there. Also I get the error "The remote server machine does not exist or isn't available"
Any help would be greatly appreciated and of course let me know if you need more information
******
Sub ThemeBlankBox()
Dim Path As String
Dim objDoc As Word.Document
Dim objWord As Word.Application
Dim oCell As cell
Dim oRow As Row
Sheets("Data").Select
FinalRow = Range("A9999").End(xlUp).Row
For I = 2 To FinalRow
Path = Sheets("Data").Range("H" & I).Text
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(Path)
objWord.Visible = True
With objDoc
For Each oRow In ActiveDocument.Tables(1).Rows ' this is where the error appears when running line by line (F8)
For Each oCell In oRow.Cells
If oCell.Range.Text = Chr(13) & Chr(7) Then
Range("K" & I).Value = "Empty Cells Present"
Else
Range("K" & I).Value = "Complete"
End If
Next oCell
Next oRow
End With
Next I
objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
objWord.Quit
End Sub
****