[python-win32] Deletion of worksheet without the confirmation prompt

Dan Palmer Dan.Palmer@sympatico.ca
Thu, 7 Mar 2002 17:50:33 -0500


This is a multi-part message in MIME format.

------=_NextPart_000_0021_01C1C600.94290360
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

When using win32com how does one delete a sheet from a workbook either =
by=20
name or by number without the confirmation dialog prompt.=20


      import win32com.client=20
      ExcelApp=3D win32com.client.Dispatch("Excel.Application")=20
      ExcelApp.Worksheets.Add()=20
      sht =3D ExcelApp.Worksheets(1)=20
      sht.Delete()=20

            at this point it generates a confirmation dialog, if I =
acknowledge the=20
            dialog it does delete the proper sheet.  Is there a way to =
turn the=20
            confirmation off (either as a preference, or as a parameter =
to delete)=20
          =20
    =20


Thanks in advance



------=_NextPart_000_0021_01C1C600.94290360
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Courier New"><FONT =
face=3DArial=20
size=3D3>When using win32com how does one delete a sheet from a workbook =
either by=20
<BR>name or by number without the confirmation dialog prompt.=20
<BR><BR></FONT></DIV></FONT>
<DIV>
<TABLE>
  <TBODY>
  <TR>
    <TD width=3D1 bgColor=3D#cccccc>
      <DIV>&nbsp;</DIV></TD>
    <TD width=3D5>
      <DIV>&nbsp;</DIV></TD>
    <TD>
      <DIV><TT>import win32com.client <BR>ExcelApp=3D=20
      win32com.client.Dispatch("Excel.Application")=20
      <BR>ExcelApp.Worksheets.Add() <BR>sht =3D ExcelApp.Worksheets(1)=20
      <BR>sht.Delete() <BR></DIV></TT>
      <TABLE>
        <TBODY>
        <TR>
          <TD width=3D1 bgColor=3D#cccccc>
            <DIV>&nbsp;</DIV></TD>
          <TD width=3D5>
            <DIV>&nbsp;</DIV></TD>
          <TD>
            <DIV><TT>at this point it generates a confirmation dialog, =
if I=20
            acknowledge the <BR>dialog it does delete the proper =
sheet.&nbsp; Is=20
            there a way to turn the <BR>confirmation off (either as a=20
            preference, or as a parameter to delete)=20
        =
<BR></DIV></TT></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>=

<DIV><TT><FONT size=3D3></FONT></TT>&nbsp;</DIV>
<DIV><TT><FONT size=3D3>Thanks in advance</FONT></DIV>
<DIV><BR></DIV></TT></FONT></BODY></HTML>

------=_NextPart_000_0021_01C1C600.94290360--