You are here:

VB Script/Delete and Add new Excel Sheet using Vb script

Advertisement


Question
Hi

I have Created a Generic Application in Excel using VB Script.In this App I am Browsing the Excel File and Displaying all sheets in a List Box
And adding them to a new List Box.I am activating a sheet by clicking an Activate button.The Problem I have is I am not able to Delete and add a Excel Sheet to the Excel App on click of a Button by calling the Methods.
Plz help me in this matter.
Thanks in Advance.

Answer
The Delete method of the Worksheet object in Excel shows a dialog box by default, you may have some issues if you are operating with the Excel application not visible.  You can avoid it by setting the DisplayAlerts property of the Excel application object to False.
Regarding the Add method, it is applied on the Worksheets collection, and it usually works, as it doesn't need any additional parameters.  If you can be more specific on the error messages that you are getting I may be able to be more precise.

Hope this helps,
Miguel.

VB Script

All Answers


Answers by Expert:


Ask Experts

Volunteer


Miguel Zapico

Expertise

I can answer question about how to use scripts to consolidate data, connect different systems and automate tasks. I have no experience on using VBScript on web programming.

Experience

I have been using VBScript and Windows Scripting Host as my swiss tool for the last 6 years.

Organizations
New York PC users group (NYPC)
Independant Computer Consultants Association (ICCA)

Education/Credentials
Microsoft MCSE in Windows NT

©2012 About.com, a part of The New York Times Company. All rights reserved.