473,761 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to shut-down Excel from Python

Elias Alhanatis
56 New Member
Hello to everybody!

I have created an app which calculates some statistical data.
I use the following function to get Excel to print a page with the data.

Expand|Select|Wrap|Line Numbers
  1. def Create_Analysis_Page(Name,Job,Phone,Month,Analysing_Dict,preview=False):
  2.  
  3.     xlApp = Dispatch ("Excel.Application")
  4.     xlWb = xlApp.Workbooks.Open ("C:\\Python25\\Misthos.xlsx")
  5.     xlSht = xlWb.Worksheets (1)
  6.  
  7.     xlSht.Cells(1,2).Value=str(Name)
  8.     xlSht.Cells(2,2).Value=str(Job)
  9.     xlSht.Cells(3,2).Value=int(Phone)
  10.     xlSht.Cells(5,2).Value=str(Month)
  11.  
  12.     try:
  13.         for i in range (9,40):
  14.             xlSht.Cells(i,2).Value=Analysing_Dict[i-8][0]
  15.             xlSht.Cells(i,3).Value=Analysing_Dict[i-8][1]
  16.             xlSht.Cells(i,4).Value=Analysing_Dict[i-8][2]
  17.     except:
  18.         pass
  19.  
  20.     xlSht.Cells(41,4).Value=Analysing_Dict["Totals"][0]
  21.     xlSht.Cells(42,4).Value=Analysing_Dict["Totals"][1]
  22.     xlSht.Cells(43,4).Value=Analysing_Dict["Totals"][2]
  23.  
  24.     #Preview or not....
  25.     if preview:
  26.         xlApp.Visible=1
  27.  
  28.     #Print The Sheet...
  29.     xlSht.PrintOut()
  30.  
  31.     xlApp.Workbooks.Close()
  32.  
  33.     xlApp.Quit()
  34.  
My problem is in the last few lines , because when Excel shuts down , it pops up a "Save Changes" dialog , which is never the case in my app. How can i bypass this?
I know that's not a purely Python question , and i will post this question on the VB forum as well , but any hint from a user who's allready been there would be helpfull!!

Thank you in advance!!!

Elias
Apr 26 '08 #1
1 1102
Elias Alhanatis
56 New Member
For all users in the future:

The solution to the problem can be found here

Thanks to all of you!!!

Elias
Apr 26 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

303
17744
by: mike420 | last post by:
In the context of LATEX, some Pythonista asked what the big successes of Lisp were. I think there were at least three *big* successes. a. orbitz.com web site uses Lisp for algorithms, etc. b. Yahoo store was originally written in Lisp. c. Emacs The issues with these will probably come up, so I might as well mention them myself (which will also make this a more balanced
3
2058
by: Todd Nathan | last post by:
Have ported Until 2.5.2 which is a highly portable embedded FORTH-like language system to BeOS. Turned on -Wall cause I'm anal about cleaning up ports if I'm doing them, and have all but ONE warning that I don't seem to be able to get cleaned up... Simply... printf("%-10s %12lx %1d\n", temp->NFA->name, &temp, temp->NFA->immediate); produces a gcc2.95 warning: prim.c: In function `display_word':
8
1915
by: ApexData | last post by:
Hello I have just completed the development of a turn-key Access2k application. I am using MS Access 2000k application, not the RunTime. I have compiled it, split it (FE & BE), set all the StartUp Options to Off, and created the FE MDE. My problem is that the MS Access (File->Edit->Insert->Records->Window->Help) Menu still appears at the top of the screen, which allows the user to Exit without using the CLOSE BUTTON in my...
0
9554
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.