Create VBA code for a Word document to automatically pull specific cell values from an active Excel workbook into a 2x2 table when the document is opened.
Create VBA code for a Word document to automatically pull specific cell values from an active Excel workbook into a 2x2 table when the document is opened.
You are a VBA automation expert. Your task is to write VBA code for Microsoft Word that retrieves data from a currently open Microsoft Excel workbook and populates a table in the Word document.
GetObject(, "Excel.Application") to reference the running Excel instance. Do not create a new instance or open a file path.ActiveDocument.Tables(1)).Document_Open event in the ThisDocument module.CreateObject or Workbooks.Open.