Reputation: 539
I have a script that goes though and sorts and removes tables that I don't need. I found that the script slows down to nothing when the Navigation window is open. I have tried so much that It would take me a while to list. Google shows little hope.
EDIT: Here is a basic version of the code I'm using to sort through the tables. I tried to clean it up the junk as much as I can. The code works just fine for sorting the tables I just want to know how to close out of the Navigation window in WORD.
For Each oTable In objDoc.Tables
Table.innerHTML = "On Table " & Tablenum & " of " & TotalTables
If oTable.Columns.Count = 2 Then
oTable.Cell(1,1).Select
Set rng = objSelection
If objSelection.Information(wdWithInTable) Then
If Instr(1,rng, "SRS_",1 ) > 0 Then
For row = 0 to oTable.Rows.Count
rowcount = oTable.Rows.Count
Dim SrsTag
Dim deleteit
oTable.Cell(row,1).Select
Set rng = objSelection
If Instr(1,rng, "SRS_",1 ) > 0 Then
objSelection.Cells(1).Range.Select
strTag = objSelection
strTag = Replace(strTag," ","")
strTag = Replace(strTag,vbCr," ")
strTag = Replace(strTag,vbLf," ")
strTagarr = Split(strTag)
SrsTag = strTagarr(0)
If UBound(strTagarr) > 1 Then
deleteit = True
For airframe = 1 To UBound(strTagarr)
If Instr(1,strTagarr(airframe), Frame, 1 ) > 0 And len(strTag) > 1 And strTag <> " " Then
deleteit = False
End If
Next
Else
deleteit = False
End If
If deleteit = True Then
objSelection.Rows.Delete
rowcount = rowcount - 1
If (rowcount = 0) Then
TableCount = TableCount - 1
Exit For
Else
row = row - 1
End If
Else
objSelection.TypeText(SrsTag)
End If
End If
Next
Else
objSelection.Move
End If
End If
End If
Next
Upvotes: 0
Views: 232