J
James
In the below code, I wish to iterate through the tables on the selected
pages. What I find is that if a table is split across two pages, the
code picks up the table twice. I assume the fault lies with
"Selection.Bookmarks("\page").Select". Does anyone know why this
happens and/or have a workaround?
Tks
For i = x To y
Selection.GoTo _
what:=wdGoToPage, _
which:=wdGoToAbsolute, _
Count:=i
Selection.Bookmarks("\page").Select
Set sourcePage = Selection.Range
NumOfTables = Selection.Tables.Count
For z = 1 To NumOfTables
Set numPage = sourcePage.Tables(z).Range
numOfPage = numPage.Information(wdActiveEndPageNumber)
DetermineTableInfo sourcePage.Tables(z), TableData,
NumOfRows, NumOfColumns, _
ColHeaderStart, ColHeaderEnd,
FirstDataRow, _
IsColumnFormatAsPercent, title
WriteToWorkBook wb, TableData, Outputoffset, NumOfRows,
NumOfColumns, ColHeaderStart, _
ColHeaderEnd, FirstDataRow,
IsColumnFormatAsPercent, title, numOfPage
Next
Next
pages. What I find is that if a table is split across two pages, the
code picks up the table twice. I assume the fault lies with
"Selection.Bookmarks("\page").Select". Does anyone know why this
happens and/or have a workaround?
Tks
For i = x To y
Selection.GoTo _
what:=wdGoToPage, _
which:=wdGoToAbsolute, _
Count:=i
Selection.Bookmarks("\page").Select
Set sourcePage = Selection.Range
NumOfTables = Selection.Tables.Count
For z = 1 To NumOfTables
Set numPage = sourcePage.Tables(z).Range
numOfPage = numPage.Information(wdActiveEndPageNumber)
DetermineTableInfo sourcePage.Tables(z), TableData,
NumOfRows, NumOfColumns, _
ColHeaderStart, ColHeaderEnd,
FirstDataRow, _
IsColumnFormatAsPercent, title
WriteToWorkBook wb, TableData, Outputoffset, NumOfRows,
NumOfColumns, ColHeaderStart, _
ColHeaderEnd, FirstDataRow,
IsColumnFormatAsPercent, title, numOfPage
Next
Next