|
I am trying to create an excel file from a template file ( using the template to create excel headers and footers to appear on each page).
the SAVEAS runs and creates the new file without the header and footer info. How can I take the template with this info and carry it into the new excel file.
I am using Microsoft PIA excel library: - the biggest problem I have is getting the headers and footers (ie: on footer -page number to appear on all pages), etc
bev
oXL = CreateObject("Excel.Application") oWB = oXL.Workbooks.Open("c:\uaf_letters\openuaftemplate.XLT", 0, True, 5, "", "", True, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", True, False, 0, True) 'Get the data from the dataset (or database) and put it on the template oWB = oXL.Workbooks.Add
oSheet = oWB.ActiveSheet For Each dr In dt.Rows oSheet.Cells(rowcounter, 1) = dr.Item("territory_id") rowcounter = rowcounter + 1 Next
'Save the spreadsheet as a report oXL.ActiveWorkbook.SaveAs("c:\uaf_letters\openuaf", Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, _ Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, _ Type.Missing, Type.Missing, Type.Missing, Type.Missing)
|