Q
qa_tester
I wrote macro which suppose to go over table in word document and sum the
existing of specific word.
The problem is that I need to first count the number of tables which the
macro will run on and in the upper part of the document there are tables that
need to be ignor so I want to start the macro from certain position in the
document.
The macro (which is still in progress) is the follwoing:
ub results_2()
' results Macro
' Macro recorded ?31/08/2008 by yonit
Dim Pass_Counter As Integer
Dim Fail_Counter As Integer
Dim mytext As Range
Dim table_count
table_count = ActiveDocument.Tables.Count
For i = 1 To table_count
Set mytext = ActiveDocument.Tables(i).cell(2, 6).Range
mytext.MoveEnd Unit:=wdCharacter, Count:=-1
'MsgBox mytext.Text
If mytext.Text = "pass" Then
Pass_Counter = Pass_Counter + 1
End If
If mytext.Text = "fail" Then
Fail_Counter = Fail_Counter + 1
End If
Next
MsgBox Pass_Counter
MsgBox Fail_Counter
End Sub
existing of specific word.
The problem is that I need to first count the number of tables which the
macro will run on and in the upper part of the document there are tables that
need to be ignor so I want to start the macro from certain position in the
document.
The macro (which is still in progress) is the follwoing:
ub results_2()
' results Macro
' Macro recorded ?31/08/2008 by yonit
Dim Pass_Counter As Integer
Dim Fail_Counter As Integer
Dim mytext As Range
Dim table_count
table_count = ActiveDocument.Tables.Count
For i = 1 To table_count
Set mytext = ActiveDocument.Tables(i).cell(2, 6).Range
mytext.MoveEnd Unit:=wdCharacter, Count:=-1
'MsgBox mytext.Text
If mytext.Text = "pass" Then
Pass_Counter = Pass_Counter + 1
End If
If mytext.Text = "fail" Then
Fail_Counter = Fail_Counter + 1
End If
Next
MsgBox Pass_Counter
MsgBox Fail_Counter
End Sub