I have this Macro to try to export my table to an Excel template, but just open the excel and don't export the information but I don't know what I'm doing wrong.
Thanks for your help!
Sub Excel_Table_Export
set XLApp = CreateObject("Excel.Application") set XLDOC = XLApp.Workbooks.Open ("C:\Users\TEST.xlsx") 'obviously you can change the location/name as necessary XLApp.Visible = True Const XLPasteValues = -4163
set s=ActiveDocument.Sheets("SH03") 'Exports is the name of my Qvw tab so you need to change to wherever your object CH1107 resides ActiveDocument.Sheets("CH02").Activate ActiveDocument.ClearCache ActiveDocument.GetApplication.WaitForIdle ActiveDocument.GetSheetObject("CH02").Restore ActiveDocument.GetSheetObject("CH02").CopyTableToClipboard true set XLSheet = XLDOC.Worksheets("Hoja1") ' again this could be any worksheet name in your 'Data.xls' XLSheet.Paste XLSheet.Range("B5") XLSheet.Cells.EntireColumn.AutoFit ActiveDocument.GetSheetObject("CH02").Minimize ActiveDocument.GetApplication.WaitForIdle ActiveDocument.ClearCache