[python-win32] Setting false in Excel via COM

Tim Golden tim.golden@viacom-outdoor.co.uk
Thu, 25 Apr 2002 14:07:14 +0100


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1EC5A.1E4F4D90
Content-Type: text/plain;
	charset="iso-8859-1"

I've had a look round and haven't seen anybody else's answer to this, only
an unanswered question last December.
 
In Excel, if you want to set, say, the ActiveSheet.PageSetup.Zoom value to
False (which seems to be the equivalent of deselecting its radio button on
the dialog box) then you need to import pywintypes and use its FALSE value,
so:
 
ws.PageSetup.Zoom = pywintypes.FALSE
 
Setting the Zoom value to 0 (zero) or any integer value less than 10 (ten)
raises an exception. In this case, setting Zoom to pywintypes.TRUE also
raises an exception, but this is presumably because the concept is not valid
in this context.
 
This seems to work, but I'd love to know why.
 
TJG


________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
------_=_NextPart_001_01C1EC5A.1E4F4D90
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 5.00.3315.2870" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face="Gill Sans MT"><SPAN class=231005612-25042002>I've had a look 
round and haven't seen anybody else's answer to this, only an unanswered 
question last December.</SPAN></FONT></DIV>
<DIV><FONT face="Gill Sans MT"><SPAN 
class=231005612-25042002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Gill Sans MT"><SPAN class=231005612-25042002>In Excel, if you 
want to set, say, the ActiveSheet.PageSetup.Zoom value to False (which seems to 
be the equivalent of deselecting its radio button on the dialog box) then you 
need to import pywintypes and use its FALSE value, so:</SPAN></FONT></DIV>
<DIV><FONT face="Gill Sans MT"><SPAN 
class=231005612-25042002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Gill Sans MT"><SPAN class=231005612-25042002>ws.PageSetup.Zoom 
= pywintypes.FALSE</SPAN></FONT></DIV>
<DIV><FONT face="Gill Sans MT"><SPAN 
class=231005612-25042002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Gill Sans MT"><SPAN class=231005612-25042002>Setting the Zoom 
value to 0 (zero) or any integer value less than 10 (ten) raises an exception. 
In this case, setting Zoom to pywintypes.TRUE also raises an exception, but this 
is presumably because the concept is not valid in this 
context.</SPAN></FONT></DIV>
<DIV><FONT face="Gill Sans MT"><SPAN 
class=231005612-25042002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Gill Sans MT"><SPAN class=231005612-25042002>This seems to 
work, but I'd love to know why.</SPAN></FONT></DIV>
<DIV><FONT face="Gill Sans MT"><SPAN 
class=231005612-25042002></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face="Gill Sans MT"><SPAN 
class=231005612-25042002>TJG</SPAN></FONT></DIV></BODY></HTML>

<HTML><BODY><BR>
________________________________________________________________________<BR>
This e-mail has been scanned for all viruses by Star Internet. The<BR>
service is powered by MessageLabs. For more information on a proactive<BR>
anti-virus service working around the clock, around the globe, visit:<BR>
<A 
hrefhttp://www.star.net.uk>
http://www.star.net.uk</A><BR>
________________________________________________________________________<BR>
</BODY></HTML>

------_=_NextPart_001_01C1EC5A.1E4F4D90--