VBA from another app: Suppressing Excel confirmation dialog?

After creating/formatting several worksheets from MS Access, I'd like to delete
the "Sheetn" worksheets that got put there when I did a .WorkBooks.Add.

I avoided using them because I'm not sure how/why they are created - i.e. maybe
some user's defaults would only create 1 empty sheet or none.

So, form MS Access's VBA I'd like to do:

        On Error Resume Next
        .Worksheets("Sheet1").Delete
        .Worksheets("Sheet2").Delete
        .Worksheets("Sheet3").Delete
        .Worksheets("Sheet4").Delete
        On Error GoTo outputFile_Finalize_err

Works, sort of, but the problem is Excel's issuing a confirmation dialog before
acting on every .Delete.

I tried theSS.SetWarnings False like I'd do in MS Access, but Excel's not buying
it.  "Error#  438: Object doesn't support this property or method"

Anybody know the magic word?

-- 
PeteCresswell
0
Pete
2/5/2005 10:41:17 PM
excel 39879 articles. 2 followers. Follow

2 Replies
706 Views

Similar Articles

[PageSpeed] 15

There's an option that the user can set:

tools|options|general tab|Sheets in new workbook.

You could change this to 1.
add your workbook
change it back to the user's preference
or
just add a workbook with one sheet.

xlapp.workbooks.add(1)

The (1) means one sheet.  (Don't try (2), (3),...  It doesn't work that way.)

You could also use in the builtin template name or it's value

    Workbooks.Add template:=xlWBATWorksheet
 or
    Workbooks.Add template:=-4167


"(Pete Cresswell)" wrote:
> 
> After creating/formatting several worksheets from MS Access, I'd like to delete
> the "Sheetn" worksheets that got put there when I did a .WorkBooks.Add.
> 
> I avoided using them because I'm not sure how/why they are created - i.e. maybe
> some user's defaults would only create 1 empty sheet or none.
> 
> So, form MS Access's VBA I'd like to do:
> 
>         On Error Resume Next
>         .Worksheets("Sheet1").Delete
>         .Worksheets("Sheet2").Delete
>         .Worksheets("Sheet3").Delete
>         .Worksheets("Sheet4").Delete
>         On Error GoTo outputFile_Finalize_err
> 
> Works, sort of, but the problem is Excel's issuing a confirmation dialog before
> acting on every .Delete.
> 
> I tried theSS.SetWarnings False like I'd do in MS Access, but Excel's not buying
> it.  "Error#  438: Object doesn't support this property or method"
> 
> Anybody know the magic word?
> 
> --
> PeteCresswell

-- 

Dave Peterson
0
ec357201 (5290)
2/5/2005 11:00:16 PM
Per Dave Peterson:
>or
>just add a workbook with one sheet.
>
>xlapp.workbooks.add(1)

One sheet works for me - I know that there will always be 1 sheet and for the
first one I create, I'll just rename "Sheet1".

Thanks.
-- 
PeteCresswell
0
Pete
2/6/2005 12:00:53 AM
Reply:

Similar Artilces:

how to format a column to corespond with another
I want to make column "E" read "N/A" when column "B" reads "0". How do i do it? Put this in E1: =3DIF(B1=3D0,"N/A","") and copy down. Hope this helps. Pete On Dec 3, 9:09=A0pm, JeremyC. <Jere...@discussions.microsoft.com> wrote: > I want to make column "E" read "N/A" when column "B" reads "0". How do i = do it? =REPT("N/A",B1=0) "JeremyC." wrote: > I want to make column "E" read "N/A" when column "B" rea...

Excel as a database #3
is there any possibility that i used to print a invoice through excel for my product sale. is there any way excel can generate monthly sales book as a database. Please show me any path Thanks in advance. Rao Ratan Singh Rao, Consider Access for this project. To do this properly, you'll likely need a table for your products (your inventory or product line), one for your invoices, one for the items in your invoices, and if you're keeping customer information, one for your customers. Excel is terrific, but a lot of darn work to implement related tables, move records around, ...

Problem with komma versus period in Excel
Hej I am have problems with the use of period in Excel. I Denmark komma is the decimal seperator. If I convert (from within VB Editor) the content of a cell from "6340,00" to text and replace the komma with period I get "6340" (I wanted "6340.00). If I make the convertion in Excel and record the macro at the same time I get the desired result i my sheet. BUT when I put in my code in VBA and run it from here I still get the wrong result, "6340" and not "6340.00". I know Excel (VBA) transform "." to "," probably acording to...

dialogs in w98 vs windows xp
I compiled my VC++ application in Windows 98. I treied to run it on a Windows XP machine and some of the icon buttons were different in their dimensions and fit, as was some of the text writing. When I run it on a Windows 98 mchine, even if I change the screen resolution and dimensions, it looks right. Does XP have a different GUI? Thanks, Matt matt, Windows XP introduces improved theme support. I believe they call it a visual style. So, yes the GUI is quite different from earlier Windows versions. I do not know much more about your problem though. A lot of owner draw controls d...

Flag a date in Excel
I wish to flag a date so that 10 days later, the input date will tur red so that I can follow it up. I have seen it done but don't know ho to do it. Please hel ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com Try using conditional formatting: Select the cell(s) Click Format > conditional formatting Put the settings "Under Condition 1" as : Formula Is | =TODAY()-A5>=10 Click Format button > Font tab > Color > Red > OK Click OK -- hth ...

problems in creating file dialog in tab control
Hi,I am creating a tab control and want to pop up a file dialog when clicking one tab page. but now, the file dialog was shown up at the same time with tab control, not after selecting one page. Could some guys help me? Thanks David GetClientRect(hwndParent,&rcClient); InitCommonControls(); hwndTabCtrl=CreateWindow(WC_TABCONTROL,"", WS_CHILD|WS_CLIPSIBLINGS|WS_VISIBLE,0,0,rcClient.right,rcClient.bottom,hwndParent,NULL,g_hinst,NULL); if(hwndTabCtrl==NULL) AfxMessageBox("can't create tab control window"); m_tcitem.mask=TCIF_TEXT|TCIF_IMAGE; m_tcitem.iIma...

Excell attachement do no shows up
I got an e-mail in Outlook from someone and it is supposed to have an attachement of something in Excel, but I don't see the attachment anywhere in the Outlook window, and I don't even know where to find the attachment to open it. I do have Office 2003, but never have used Excell. Any advise on how to find the attachemnt? Thanks in advance. Octavio, This question would be better asked in an Outlook newsgroup, not an Excel newsgroup. That said, are you sure that the sender actually attached the file? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, ...

Excel shutting down when opening file
This is a follow up from a previous post. When opening a specific file with excel 2003, Excel will immediately shut down. When I re-open Excel it shows the file in the recovery box. When trying to recover the file it gives a message that file damage is too extensive to repair. I have no problem opening other Excel files. I also have Excel 2003 operating on three other computers and they do not have any problem opening the same file. I have started Excel in safe mode and tried to open the file but I get the same problem. I have started Windows XP in safe mode and then opened Exce...

Excel 2007; graph the best fit line from a regression analysis?
Try using this white space to ask you question with a bit more detail best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "mattz" <mattz@discussions.microsoft.com> wrote in message news:574CCC66-72EA-44D0-8D36-2147B6C7C279@microsoft.com... > ...

can't find how to confirm e mail address
i am new to e mail and am having trouble confirming my e mail address Outlook can't really help in that effort. What provider are you using for your email? "newcomer" <newcomer@discussions.microsoft.com> wrote in message news:8C58BB8B-64E8-4F62-B223-54D946846A9A@microsoft.com... >i am new to e mail and am having trouble confirming my e mail address ...

If I could.. another MFC / UNicode question
Thanks for the help so far folks.. I have recoded my app to use unicode and it compiles fine. It did not link as there were a large amount of unresolved external symbols. All of which are the wide versions of the MFC lib.. like GetWindowTextW, WriteProfileStringW, etc etc.. I reinstalled VS.NET 2003 and I selected the unicode libs / dlls to be installed but the build still fails to link.. I must be missing something stupid.. Thanks Elan. "Elan Magavi" <Elan@nomailnospam.com> wrote in message news:YFM9h.9584$6t.7336@newssvr11.news.prodigy.com... > Thanks for the...

Can I move Excel 2002 from my laptop to my desktop
My desktop has Excel 97 and I wish to have the same version on both computers. They are networked. You cannot 'move' Excel, or copy it. You have to install from the original CDs. If you don't have them you'd have to acquire them or you might be out of luck. -- Jim "X_Drive" <X_Drive@discussions.microsoft.com> wrote in message news:E1AA36E6-D7E2-4060-A661-1601C6879D41@microsoft.com... | My desktop has Excel 97 and I wish to have the same version on both | computers. They are networked. ...

Output query to excel 08-12-07
Hi, Can anyone help me with outputing the results of a query to a particular worksheet in an Excel workbook. Using an "Output To" macro, I've managed to output my query to Excel so that it replaces the whole .xls workbook. But what I need to do is output to Sheet 1 of the .xls workbook and leave Sheet 2 intact as it will have formulas referring to Sheet 1. Thanks Bob On Sun, 12 Aug 2007 21:52:07 +1000, Bob wrote: > Hi, > > Can anyone help me with outputing the results of a query to a particular > worksheet in an Excel workbook. > Using an "Output...

CSV in Word==>Excel....?
I have one field from a Word document that imports perfectly. Then, I have another field, separated by commas, that I would like to separate into different cells.....Is this possible? If so, how Thank you Matthew After you import the data, you could use Data>'Text to Columns' to separate the data. If it's not the last column in the imported data, move it temporarily, or insert sufficient blank columns to its right, to accommodate the split data. Matthew wrote: > I have one field from a Word document that imports perfectly. Then, I have another field, separated by comm...

Underlining text in another application...
Hi, I'm interested in being able to programmatically underline text that is being displayed in other applications. At this point I don't know where to start, though I've seen applications that do have this sort of feature... specifically off-the-shelf spelling checkers. My guess is that those applications are adding DLLs into the system folder and somehow patching into system APIs like DrawText, DrawTextEx, and TextOut. Can anyone give me a hint? Thanks in Advance, John John Tytler wrote: >Hi, > >I'm interested in being able to programmatically underline text ...

Moving outlook data + accounts to another PC
I want to move my Outlook data, email accounts, and rules to a new PC. The old PC has Outlook 2000 + Windows 2000. The new PC has Outlook 2003 + Windows XP. Neither will use Exchange server. I know that you can copy over the outlook.pst file, but presumably this won't hold my email accounts. Also, I vagely remember that simply copying over the pst file can damage the profile. http://www.howto-outlook.com/howto/backupandrestore.htm Be aware if you wish to use the OL2003 format pst you will need to create a new pst and copy data from old to new. Accounts stored in the registry and no...

Printing In Excel 12-01-09
I am sure I posted this but cant see it On-Line I have an Excel file that when i try and print it states 1 of 2368 Pages? The file is ok on another PC, would this be a virus or? Never seen this before and I am sure file is ok Thanks for any help Steve On Dec 1, 11:05=A0am, k11ngy <k11...@discussions.microsoft.com> wrote: > I am sure I posted this but cant see it On-Line > > I have an Excel file that when i try and print it states 1 of 2368 Pages?= =A0 > The file is ok on another PC, would this be a virus or? =A0Never seen thi= s > before and I am s...

Excel should allow you to change custom colours more easily
Dear Microsoft... With other office products you can change the custom colours very easily, with excel you have to go into tools, then options, then change the colours... Please make it as easy as the other office products. Thanks ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the ...

another ? about using distinctrow (or some alternative)
Hi all I have a query that I would like to eliminate records where one field may have duplicate values. I was of the impression that there was something i could put in the "criteria" field in the query design view that would eliminate duplicate records for the field. I have tried "unique" , "distinct" "count(*)=1" ect. but none of these seem to work. Is this more complicated than I think? Any suggestions would be appreciated. BRC On 15 Apr 2007 17:31:10 -0700, "BRC" <sgos4v-googrp@yahoo.com> wrote: >Hi all >I have a query that...

Using the Common Feed List in Excel
Is it possible to collect items from the Common Feed List (RSS feeds) generated by IE into Excel? I would like to screen a bunch of feeds from Craigslist and eBay and none of the readers I've tried seem to do it very well. TIA ed I have used the IE application with Excel to read 1000's of webpages. Depending on the Website it can be very simple, not so simple, or very complicated. Not all webpages are the same even though the make look similar. I don't know what you mean by "to do it very well". The code may not be simple. I would have to see the U...

Excel help please
How to add clip art in excel behind text & grid lines? I am trying to install Excel to my computer. On the box it does not indicate that Microsoft Office 2003 is necessary and I don't have Office 2003. Is that why I cannot install Excel? -- George "Anthony" wrote: > How to add clip art in excel behind text & grid lines? You should be able to install Excel as a stand-alone. -- HTH Bob Phillips (remove nothere from the email address if mailing direct) "george" <george8798@pacbell.net> wrote in message news:6367F467-57A8-442D-AEFF-D586744EC...

Excel 2007 03-10-10
Question: Can Excel arrange items in 'alpaphabetical' order all at once if items are all put into one column after a person is through inputting them? Or must everything be input in 'alphabetical' order? Thank you. Dave __________ Information from ESET NOD32 Antivirus, version of virus signature database 4932 (20100310) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com Click Data, Sort David Dyke wrote: > Question: Can Excel arrange items in 'alpaphabetical' order all at once if > items are al...

Export Excel data to Access
I have an Excel wookbook template that I use to create new project files to track and manipulate data on individual projects. I also have an Access database where I record some common data as the spreadsheet resulting in duplicate data entry. How can I export data easily (i.e. novice programming experience)on a regular basis from these separate Excel files to a common Access table to eliminate this duplicate data entry? Thanks, Jim H. Jim, initiate the process from Access. Open your Access database and File > Get External Data > Import. Set Files of type to Microsoft Excel, then ...

Excel 2003 charting circular or spherical coordinates
Long time user of Excel, long time issue: Is there a way to plot (chart) using circular or spherical coordinates? I have Excel 2003. Scott - Go to the charting section of Stephen Bullen's web site: http://oaltd.co.uk/Excel/SBXLPage.asp#Charting and look for FunChrt6.zip, which shows how to use polar coordinates. - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ Scott @ Nordion wrote: > Long time user of Excel, long time issue: > Is there a way to plot (chart) using circular or spherical...

How do I view and edit the source code for a Chart in Excel 2003?
Is there a way to access the code (VBA?) for a Chart created in Excel 2003? I have generated a complicated Chart or graph which I want to then "Copy" and modify to make several more which access different spreadsheets. It is cumbersome to click in the Toggle box for the data ranges for X and Y. Instead, I was hoping there might be a way to use Search and Replace to change the text describing the data ranges. EBB Excel does not create VBA when creating a chart unless you have specifically recorded the steps of creating it (Tools>Macros>Record New Macro...). Even when y...