Referencing a table inside a textbox with VBA

Hello,

I have been handed a word document that has had a table created inside a textbox. My task is to auto populate the cells of the table using VBA with data sourced from a database.

I can open the document and reference the shape that is the textbox, but I have no idea how to take the next step and get to the table.

Aside from redesigning the document to lose the textbox and just have the table, can anyone suggest a way to access the table?

Thanks

Answer
Answer

Basically, the code to reference the table is:

Activedocument.Shapes(1).TextFrame.TextRange.Tables(1)

Cheers
Paul Edstein
(Fmr MS MVP - Word)

5 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated July 16, 2023 Views 2,425 Applies to: