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
710 Views

Similar Articles

[PageSpeed] 47

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:

i cannot use the mouse right click in excel. how to rectify?
i cannot use the mouse right click in excel. how to rectify? Is this just when over the cells ? Does it work on the title bar - windows options Or on the Excel menus ? Steve On Tue, 19 Sep 2006 14:21:01 +0100, j <j@discussions.microsoft.com> wrot= e: > i cannot use the mouse right click in excel. how to rectify? Unless the right-click button is frozen, I'm sure you can use the mouse right-click in Excel Just hit the right-click button. Now...........................the real issue What are you right-clicking on and what doesn't happen for you? Does the right-click no...

Calling a module from another module
Hi, I found this macro to reset the last cell from an Excel forum: Sub ResetLastCell() ' http://support.microsoft.com/default...&Product=xlw2K ' Save the lastcell and start there. Set lastcell = Cells.SpecialCells(xlLastCell) ' Set the rowstep and column steps so that it can move toward ' cell A1. rowstep = -1 colstep = -1 ' Loop while it can still move. While (rowstep + colstep <> 0) And (lastcell.Address <> "$A$1") ' Test to see if the current column has any data in any cells. If Appli...

import hyperterminal value into excel
How do I import a hyperterminal value into an excel cell? ...

Excel Function to Access
I would like this excel function =IF(A4=A5,C5-C4,C5) to be utilized a a function in a query in MS Access where the fields that supposed t be in column A are the primary key fields and the next fields whic are in column C, are to be calculated in.The answers to this functio are to go into a new field.....Any help please? : Primary key, by definition, means no duplicates. How would A4 ever equal A5? -- George Nicholson Remove 'Junk' from return address. "CJT" <chico_2186@yahoo-dot-com.no-spam.invalid> wrote in message news:Wa-dnQuiOcaYskDfRVn_vQ@giganews.com... &g...

Is it possible to have 2 excel version in one computer?
hi everyone i just installed a 2003 version office... i liked the new features but when i wanted to open an excel file that has been created by 2002 version excel, i was shocked that i can't open the file successfully. When i opened and enabled the built in macros in the file, an error message popped out and said that the data may have been lost. After I have closed the error message, i checked the file. the data is still in the worksheet but all the words, format, buttons, and other information have all disappeared. However, if I open it in another version other than 2003, the file work...

Free MS Excel/Access Video Tutorials and Articles
Hey All, There are a whole bunch of free articles and video tutorials at http://www.davidbase.com. There's no cost to sign up and there are lots of articles and videos to check out. Some of the topics are Access VBA, Excel, Database Design, Reporting, Union Queries and more. Some recent articles: Access Parameter Queries Union Queries Excel VBA Random Numbers Relationships and Joins � and plenty more. Sign up (it's free) right on the home page and see if it suits you. Thanks, AppTrix Staff http://www.davidbase.com ...

[Win7 x64] Move partition C to another drive
Hi. I have Windows 7 installed on a primary 1/3 partition of a 300Gb SATA hard drive. The other 2/3 is are logical partitions of 100Gb each. Needless to say, I am running out of room on drive C and also want to have my OS on my biggest and fastest hard drive that I have. In the system is another 1Tb SATA drive broken into 4 250Gb primary partitions for storage. I just put in another 1Tb drive last night, broke it into 4 primary partitions of 250Gb each, and gave it drive letters of L, M, N, & O. Because of this and my mounted shares, I am running out of drive letters and cann...

Excel Formulae #3
Hi, I have a spreadsheet with value in one column & a series of dates in 5 other columns.For each row depending on the value in the first colunm a date may be applicable in one or more of the other columns.e.g 550 in the first column will mean dates will be inserted in the next 2 columns similar to authority levels. My qn. is how can I show what's outstanding if the relevant authority levels have not signed off-basically this is used as a tracker of invoices & I would like to show what is outstanding awaiting approval at anytime. Thanks Raj ----------------------------------...

Excel -- Wrapped text disappears
A user here is having the same problem as described in a previous topic (http://groups.google.com/group/microsoft.public.excel/browse_thread/thread/b32b50c3e69981d/dc8adb6c01616d70%23dc8adb6c01616d70). Windows XP Pro, SP2 Office 2003 Pro, SP2 New machine with plenty of resources. Was originally working properly, then mysteriously developed a strange symptom: Any text that is in an Excel cell in which the "wrap text" option has been selected no longer shows up. I have checked it with 1 character, 1 word, and multiple lines of text. It has been repeated with spreadsheets created on...

Bug in excel 2003
Hi, I'm trying to get an equation of a table of data. When I enter the data, make a graph of it, I get a nice sinus-kind-of-line. Therefor I would like to have fourth order equation. The line of data looks very good (125 data points). Then I add a trendline (4th order) that looks like a very nice fit. But when I set the properties of the trendline to "show equation in graph" the a wrong equation is displayed. After a lot of fiddling with data, I noticed that the shown equation has wrong contstands showing. E.g.: The shown eqaution = A + B*X + C*X^2 + D*X^3 + E*X^4 In fact ...

EXCEL caused an invalid page fault #3
Whenever I start EXCEL 2000 I get the following msg. EXCEL caused an invalid page fault in module EXCEL.EXE at 018f:3001de79. Registers: EAX=900a0154 CS=018f EIP=3001de79 EFLGS=00010246 EBX=00100000 SS=0197 ESP=0062eb5c EBP=0062ebf0 ECX=0000c630 DS=0197 ESI=50020044 FS=0ebf EDX=30021a90 ES=0197 EDI=300378d4 GS=0000 Bytes at CS:EIP: 0f bf 04 c5 aa df 01 30 89 45 dc 8d 45 e4 50 e8 Stack dump: 50020044 006b76e4 006b7608 006b7608 0062ebf0 006b7608 006b76e4 006b7608 0062eb54 3001dcc3 00000000 bff728a2 bff54f53 1294bb9c ad4c17af 12990002 I had reinstalled and repaired several times but it does n...

Please help me: Refresh pivot table using another source file.
My supervisor put an interactive spreadsheet (or pivot table) on the web. Now he wants me to make changes to the spreadsheet so that when you click "Refresh" on the website, this spreadsheet gets new data from me rather than from my supervisor. How do I do this? Thanks for your help. ...

Time formats in Excel 2003
Being in the UK, I obviously want to use the English(UK) date format, so Christmas Day is 25/12/05 rather than 12/25/05. However, this defaults the time format to hh/mm/ss (why, I do not know, since I can assure American readers we're not normally that precise), so I have to reset it English(US) to get hh/mm, which resets the default date format to mm/dd/yy, so I have to change it back the next time I want to format a cell as a date. Any way round this? It's only a minor problem but it's irritating me. Steve Stephen, If you set up your own custom format with hh/mm, it w...

excel passwords #2
I need to know how to set up a password and change a password to prevent access to my workbook.TIA Use workbook/sheet protection. Select tools menu>protection. There you can select the type of protection you want and include a password Regards, F.I. >-----Original Message----- >I need to know how to set up a password and change a >password to prevent access to my workbook.TIA >. > ...

Excel 2007 Back-up copies
How do I stop Excel from creating a "back-up" copy everytime I "save" a document? It only does this when I "Save" not when I "save as". My folders are quickly filling up with back-ups. This just started happening after I upgraded to Windows 7. -- Hawaiianshirt Does that happen for all workbooks or a specific one. Open the workbook>from Save AS dialog>Tools>General Options> check whether 'Always create backup' is enabled or not? If this post helps click Yes --------------- Jacob Skaria "Hawaiianshirt...

Reading Registry Key through excel?
Is there anyway to read a certain registry key and display it in a cell how about a way to create a key through excel? is that possible -- Message posted from http://www.ExcelForum.com Rav, There is a special registry area for VBA which is read/written via GetSettinmg and SaveSetting functions. It is a bit restrictive, in that in can only writes to a limited part of the registry, but it's sufficient for storing application details. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "ravz &g...

where can I find a nurse staffing templatew for excel 2000
I need an excel template for excel 2000 that would allow me to staff nurses Try the Office Template Gallery. http://officeupdate.microsoft.com/templategallery/default.asp Gord Dibben MS Excel MVP On Mon, 17 Mar 2008 17:54:00 -0700, klif_e <klife@discussions.microsoft.com> wrote: >I need an excel template for excel 2000 that would allow me to staff nurses ...

Excel 2003, when I click on a particular cell it gets deselected
While using Excel 2003, when I click on a particular cell, within 30 seconds, that particular cell gets deselected followed by the workbook. So each time I need to click either the cell or workbook to enter data in that particular sheet. There could be event code that is being fired. Does this happen if you open the workbook with macros disabled? HTH, Bernie MS Excel MVP "towinwin" <towinwin@discussions.microsoft.com> wrote in message news:B7B87AFB-27AC-4235-9AE3-5E7A46310AF8@microsoft.com... > While using Excel 2003, when I click on a particular cell, within 30 se...

Text in VBA
Hello, I'd like, if possible, in VBA to have an inputbox that will allow me to write a text in J1 if B1 has value but J1 is empty. Is that possible? Hi how should this inputbox be invoked? -- Regards Frank Kabel Frankfurt, Germany "Jeff" <Jeff@discussions.microsoft.com> schrieb im Newsbeitrag news:A7813AAF-1A10-4F19-86D8-80F25F89434F@microsoft.com... > Hello, > > I'd like, if possible, in VBA to have an inputbox that will allow me to > write a text in J1 if B1 has value but J1 is empty. > Is that possible? > This inputbox should be invoked if...

Need To Add VBA Tools Like A Date Picker
I have written a couple of VBA projects for my company. Most of the computers run them all fine but some do not. About half of the computers are running Windows XP Pro w/ Office XP Small Buisness and the other Half are running on Windows 2000 Pro w/ Office 2000 Small Business. My problem is that some of the office 2000 computers do not have Date Pickers in there VBA so they get errors when they try and run the programs. It says something like error: project cannot be found. I want to know where I can update my VBA tools from. Any help would be greatly apprecitated. Thanks, Mark ...

Can VBA copy then paste shape and its Sub ( )? found at pptfaq.com
Hi I have a shockwave flash object embedded on a slide, it has a simple FSCommand sub. I can use this macro to copy the afore mentioned shockwave object to all sides but the associated FScommand sub which I can see in the object tree on slide1, does not get transposed to the other slides. Doers anyone know if this is beyond a macro to perform this type of function? Sub flashbutton()) Dim oSh as Shape Dim x as Long Set oSh=ActiveWindow.Selection.ShapeRange(1) oSh.Copy For x = 2 to ActivePresentation.Slides.Count ActivePresentation.Slides(x).Shapes.Paste Next End S...

excel find problems
I have a database in excel with 4 sheets. When I want to conduct a search, it only searches the active sheet. Therefore I have to select each sepearte sheet and carry out 4 individual searches. Is there any way to search all sheets at once? If there is not, I am aware I can create a user form and use the approproate syntax to conduct my required search. However this will take me a long time. If there is an easier apprach then please let me know. Regards camron What version of excel? How are you searching? In later versions of Excel, you can select multiple sheets and have Edit|Fin...

how to copy a row of cells automatically from one worksheet to another by changing the value of1cell
Hello. I have 8 cells on the same row in one worksheet that I would like to be automatically copied to a predefined area in one of 3 other worksheets in my file depending on the number (1, 2 or 3) entered in one cell adjacent to these 8 cells. Is this possible and, if so, how could it be done? Thanks very much for any help you can offer me with this. ** Posted via: http://www.ozgrid.com Excel Templates, Training, Add-ins & Software! http://www.ozgrid.com/Services/excel-software-categories.htm ** David, You could use the worksheet change event: this will copy the eight cells from the s...

Excell won't open
I have produced a series of spreadsheets this morning. (Excel 2003) on my laptop. Have been saving them on a shared network folder. I have come to open them again and all I get is a the excel background with no worksheet. They all opened fine earlier this morning. Every other machine on the network can open the spreadsheets (from this location) just fine. I can open other spreadsheets from that same folder that I produced on other days. If I copy this morning's spreadsheets to my laptop, they still won't open. In all other aspects Excel works fine. If I save a new workshee...

Populating a table with filtered result of another table
Hi, I have a worksheet that has a large table that I filter by a certain column. Is it possible to populate a table on a second worksheet that is the filtered result of the first worksheet's table? For instance, if I have a table listing types of cars and their color / make / etc. I sort it to see only Red cars. Is it possible to have my second worksheet populated with a table of red cars, and my third worksheet populated with a table of green cars? -- pikakathy ------------------------------------------------------------------------ pikakathy's Profile: http://www.excelforum.c...