A
Alex St-Pierre
Hi,
I have a table in Word and I replace it by a range table in excel. Excel
range ("table1_1") should go to replace the table in bookmark("table1_1"), ...
I use the following codification but the table #2 and #3 are copied inside
word table #1 (last cell) ?? When I delete the second table, it's like if the
cursur is going to table #1. Is there a way to use a replace table instead of
using delete and copy-paste function ?
Thanks !
--
Alex St-Pierre
For nbTab = 1 To 3
If nbTab = 1 Then
Set rngExcel = wbExcel.Application.sheets("table1.1").Range("table1_1")
Set rng = docWord1.Bookmarks("Table1_1").Range
ElseIf nbTab = 2 Then
Set rngExcel = wbExcel.Application.sheets("table1.2").Range("table1_2")
Set rng = docWord1.Bookmarks("Table1_2").Range
ElseIf nbTab = 3 Then
Set rngExcel = wbExcel.Application.sheets("table1.3").Range("table1_3")
Set rng = docWord1.Bookmarks("Table1_3").Range
End If
Set tbl = rng.Tables(1)
tbl.Delete
rngExcel.Copy
Selection.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False,
RTF:=True
Set tbl = rng.Tables(1)
...
Next nbTab
I have a table in Word and I replace it by a range table in excel. Excel
range ("table1_1") should go to replace the table in bookmark("table1_1"), ...
I use the following codification but the table #2 and #3 are copied inside
word table #1 (last cell) ?? When I delete the second table, it's like if the
cursur is going to table #1. Is there a way to use a replace table instead of
using delete and copy-paste function ?
Thanks !
--
Alex St-Pierre
For nbTab = 1 To 3
If nbTab = 1 Then
Set rngExcel = wbExcel.Application.sheets("table1.1").Range("table1_1")
Set rng = docWord1.Bookmarks("Table1_1").Range
ElseIf nbTab = 2 Then
Set rngExcel = wbExcel.Application.sheets("table1.2").Range("table1_2")
Set rng = docWord1.Bookmarks("Table1_2").Range
ElseIf nbTab = 3 Then
Set rngExcel = wbExcel.Application.sheets("table1.3").Range("table1_3")
Set rng = docWord1.Bookmarks("Table1_3").Range
End If
Set tbl = rng.Tables(1)
tbl.Delete
rngExcel.Copy
Selection.PasteExcelTable LinkedToExcel:=False, WordFormatting:=False,
RTF:=True
Set tbl = rng.Tables(1)
...
Next nbTab