I currently have a macro which works fine at exporting a number of tables into various Excel sheets and then saving that document. However, I'm finding it hard to save into an existing document. I know I can overwrite a document that is already saved but i want to keep the template that is already in place in the Excel Sheet. Does anyone have any ideas on how to complete this?
Hi, I have an app running in our support dept at the moment that opens an excel sheet that is effectively a template and then drops tables, formulae etc from a qlikview macro into it and then saves the sheet as a finished file. It is renamed using a variable name [in our case whichever customer name/data has been loaded into qlikview] and a date variable [again in our case the qlikview data loading date]. The saving of the sheet effectively leaves the original excel template sheet in place and untouched ready for re-use. Code is as per:
Sub ExcelExport set s=ActiveDocument.Sheets("Intro") set XLApp = CreateObject("Excel.Application") set XLDOC = XLApp.Workbooks.Open ("C:\UK\Templates\Test_Template.xlsx") XLApp.Visible = True
[add whatever code to paste tables formulae etc..]
XLSheet.SaveAs "C:\UK\Customer's Data\Test - " & [mynamevar] & " - " & [mydatevar] & ".xlsx" set XLApp = Nothing set XLDOC = Nothing End Sub