Deleting/removing content on Word table using Excel VBA (not Word VBA)

ulster0709

New Member
Joined
Aug 14, 2016
Messages
13
Hi Experts,


I have just learned vba few months ago and I have a problem that I havent been able to solve, could you help me or give me some advice please.


I am using VBA excel to copy a table from excel into a table on word (the table on word has invisible border and it is just for layout/structure purposes and facilitate navigation when using excel vba), however, before I paste the table, how can I delete/clear the content that was already present on the word table using excel vba? Below is the code where changes needed to be made.
Code:
WDApp.Activate
With WDApp
WDdoc.Tables(1).Rows(5).Select
'WDdoc.tables(1).Rows(5).Clearcontents <- it didnt work
'WDdoc.tables(1).Rows(5).delete <- it worked, but I dont know how to add a row on word table, I need this particualr row becuase it is the row to which the table from excel will be pasted
End With


Thank you
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Thanks for clarifying. Does that mean Word VBA would also work on Excel?

If you were me, how would you adjust the code in #17 so that the table pasted would be in the centre on Word?

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,809
Messages
6,174,759
Members
452,581
Latest member
ruby9c

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top