T
Tony
I want to execute the macro called on all rows in the table. As the
parameters for the macro I need to use values from first column (this is
assigned to SearchFor) and second column (this is assigned to PlaceNo). I can
not find the syntax to be used for running through all rows in the table and
assigning cells values to those two variables. Below I have placed the code I
am trying to fix.
*****************************************************
Sub ProcessTable()
Dim mytable As Table
Dim mycell As Cell
Dim myrange As Range
Set mytable = ActiveDocument.Tables(1)
With ActiveDocument.Tables(1).Range
intCount = 1
For Each Row In mytable
Set myrange = ActiveDocument.Tables(1).Cell(intCount, 1).Range
myrange.MoveEnd Unit:=wdCharacter, Count:=-1
SearchFor = myrange
Set myrange = ActiveDocument.Tables(1).Cell(intCount, 2).Range
myrange.MoveEnd Unit:=wdCharacter, Count:=-1
PlaceNo = myrange
OpenAllFilesInFolder
Next Row
End With
End Sub
*****************************************************
Can someone help me and advise how to modify the code so that it will work.
Thanks.
Tony
parameters for the macro I need to use values from first column (this is
assigned to SearchFor) and second column (this is assigned to PlaceNo). I can
not find the syntax to be used for running through all rows in the table and
assigning cells values to those two variables. Below I have placed the code I
am trying to fix.
*****************************************************
Sub ProcessTable()
Dim mytable As Table
Dim mycell As Cell
Dim myrange As Range
Set mytable = ActiveDocument.Tables(1)
With ActiveDocument.Tables(1).Range
intCount = 1
For Each Row In mytable
Set myrange = ActiveDocument.Tables(1).Cell(intCount, 1).Range
myrange.MoveEnd Unit:=wdCharacter, Count:=-1
SearchFor = myrange
Set myrange = ActiveDocument.Tables(1).Cell(intCount, 2).Range
myrange.MoveEnd Unit:=wdCharacter, Count:=-1
PlaceNo = myrange
OpenAllFilesInFolder
Next Row
End With
End Sub
*****************************************************
Can someone help me and advise how to modify the code so that it will work.
Thanks.
Tony