Saturday, January 21, 2012

Excel VBA Programming in VBScript

'''' Note copy the Whole Script and paste into notepad and save the notepad file with "filename.vbs" extension and click the saved notepad file to run Vbscript

Dim xl, y
set xl=createobject("Excel.application")
xl.visible=1
xl.workbooks.add
call add_sheets

Sub add_sheets()
Dim sname
If MsgBox("Do you Want to Add More Sheets", vbYesNo) = vbYes Then
sname = InputBox("Enter the Name for New Sheet")
xl.Sheets.Add.Name = sname
Else
Exit Sub
End If
Call add_sheets
End Sub

No comments:

Post a Comment

Excel VBA to send email from excel with HTML table in a email body

'' Excel vba script to send email from outlook & email body in HTML table format. ''Write down email body in HTML tags...