Я пытаюсь определить, какой номер страницы текущей таблицы в итерации, с кодом ниже:
Set wdDoc = GetObject(wdFileName) 'open Word file
With wdDoc
tableNo = wdDoc.tables.Count
tableTot = wdDoc.tables.Count
If tableNo = 0 Then
MsgBox "This document contains no tables", _
vbExclamation, "Import Word Table"
ElseIf tableNo > 1 Then
tableNo = InputBox("This Word document contains " & tableNo & " tables." & vbCrLf & _
"Enter the table to start from", "Import Word Table", tableNo)
End If
resultRow = 4
For tableStart = 1 To tableTot
With .tables(tableStart)
'copy cell contents from Word table cells to Excel cells
For iRow = 1 To .Rows.Count
For iCol = 1 To .Columns.Count
Cells(resultRow, iCol) = WorksheetFunction.Clean(.cell(iRow, iCol).Range.Text)
Next iCol
Cells(resultRow, 4) = pageNumber
resultRow = resultRow + 1
Next iRow
End With
resultRow = resultRow + 1
Next tableStart
End With
Я исследовал способ и нашел это
oTable.Range.Information(wdActiveEndPageNumber)
Iпопытался использовать его, выполнив
pageNumber = .Range.Information(wdActiveEndPageNumber)
, но, очевидно, он не работает, потому что я на самом деле не перебираю активные объекты.в основном:
wdDoc.tables(1-N).Range.Information(wdActiveEndPageNumber);
, который не работает, ошибка в wdActiveEndPageNumber,
есть ли способ получить номер страницы?