Search For Knowledge

Google

Wednesday, November 21, 2007

A good function to get ur o/p in XLS

Here is a good function in VBS to generate your application output in XLS.


Function create_excel ()

Dim xl, St
Set xl = CreateObject("Excel.Application")
xl.Workbooks.Open "C:\Project-Main\Project-Sub\Output.xls"
Set St = xl.ActiveWorkBook.Worksheets("Global")
St.Cells(2,13) = "123"
xl.ActiveWorkbook.Save
xl.ActiveWorkbook.Close
xl.Application.Quit

End Function

This function will export the data from the Global sheet to Output.xls

-jerry (Thanks to RD)

No comments: