dj44
03-03-2017, 03:42 PM
good evening folks:)
I am trying to copy the cell id before each table.
The cell - first one I put some text in it like an ID.
Now I am trying to paste that before each table - so I know where each table should be, when it gets moved or lost
Sub InsertAfterEachTable()
Dim oTable As Table
Dim i As Long
Dim SourceCell As cell
Dim DestCell As cell, Temp As cell
With ActiveDocument
For i = .Tables.Count To 1 Step -1
Set oTable = .Tables(i)
Set SourceCell = ThisDocument.Tables(i).cell(1, 1)
SourceCell.Range.Copy
SourceCell.Range.Paste
' something not right here
Next i
End With
lbl_Exit:
Exit Sub
End Sub
No Cell Id was pasted, and Im not sure why.
I am trying to copy the cell id before each table.
The cell - first one I put some text in it like an ID.
Now I am trying to paste that before each table - so I know where each table should be, when it gets moved or lost
Sub InsertAfterEachTable()
Dim oTable As Table
Dim i As Long
Dim SourceCell As cell
Dim DestCell As cell, Temp As cell
With ActiveDocument
For i = .Tables.Count To 1 Step -1
Set oTable = .Tables(i)
Set SourceCell = ThisDocument.Tables(i).cell(1, 1)
SourceCell.Range.Copy
SourceCell.Range.Paste
' something not right here
Next i
End With
lbl_Exit:
Exit Sub
End Sub
No Cell Id was pasted, and Im not sure why.