ListObjects("Table1").Resize chartWorkSheet.Range("A1:" & LastColumn & RowCount) ListObjects("Table1").DataBodyRange.Delete 'Resize chart data area to table size and paste table data LastColumn = Chr(Int(ColumnCount / 26) + 64) & Chr((ColumnCount Mod 26) + 64) 'Determine spreadsheet column letter for last column of table Sub MakeChartFromTable()įor Each myTable In ActiveDocument.Tables It is important to note that for this VBA code to work properly, it should contain a reference to the Microsoft Excel 14.0 Object Library (for those that do not know how to do this, the article linked to above explains how to add this reference in detail). It was based on code found in a fantastic article entitled "Creating Charts with VBA in Word 2010" by Peter Gruenbaum which can be read here: The solution below should work for Word 2007 SP2 and Word 2010.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |