Today while practicing vb script i came up with a little doubt please help to clear my doubt. I have written this code and created a excel sheet in my D: drive
dim excel
SET excel=CreateObject("Excel.Application")
excel.Visible=true
excel.application.Workbooks.Add
excel.ActiveWorkbook.SaveAs"D:\pushkar23.xls"
excel.quit
SET excel=nothing
But if I change the line
excel.application.Workbooks.Add
to
excel.Workbooks.Add
then still the sheet is created in my D: drive.
Please tell me if there is any difference between both methods.
If you look at the docs, you'll see that the Application object (and some others, e.g. Workbook) has an Application property that
It's always the same:
Option Explicit
output:
For efficency and clarity, however, you should use plain oExcel wherever possible.