Archive
Posts Tagged ‘VBS Tutorial’
How to add a sheet in Excel through VB Scripting.
May 21, 2010
1 comment
Please find the code.
Set obj_ExcelSheet = CreateObject(“Excel.Application”)’ creating the excel object
obj_ExcelSheet.visible = True
obj_ExcelSheet.SheetsInNewWorkbook = 1 ‘ no of sheets to be added
obj_ExcelSheet.Workbooks.Add() ‘ actually adding the sheet to the file
obj_ExcelSheet.Worksheets(1).Activate ‘ make the sheet no-1 activate
obj_ExcelSheet.Activesheet.Name = “Check” ‘name of the sheet
obj_ExcelSheet.ActiveWorkbook.saveas (“C:\Documents and Settings\username\Desktop\MF.xls”) ‘saving the file in desired location.
obj_ExcelSheet.quit ‘ quiting from the excel.
Set obj_ExcelSheet = nothing
Please provide your feedback.
Related articles by Zemanta
- Create A List Of Excel Worksheets (lockergnome.com)
Advertisements