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.
Code: ( text )
def Create_Analysis _Page(Name,Job, Phone,Month,Ana lysing_Dict,pre view=False):
xlApp = Dispatch ("Excel.Applica tion")
xlWb = xlApp.Workbooks .Open ("C:\\Python25\ \Misthos.xlsx")
xlSht = xlWb.Worksheets (1)
xlSht.Cells(1,2 ).Value=str(Nam e)
xlSht.Cells(2,2 ).Value=str(Job )
xlSht.Cells(3,2 ).Value=int(Pho ne)
xlSht.Cells(5,2 ).Value=str(Mon th)
try:
for i in range (9,40):
xlSht.Cells(i,2 ).Value=Analysi ng_Dict[i-8][0]
xlSht.Cells(i,3 ).Value=Analysi ng_Dict[i-8][1]
xlSht.Cells(i,4 ).Value=Analysi ng_Dict[i-8][2]
except:
pass
xlSht.Cells(41, 4).Value=Analys ing_Dict["Totals"][0]
xlSht.Cells(42, 4).Value=Analys ing_Dict["Totals"][1]
xlSht.Cells(43, 4).Value=Analys ing_Dict["Totals"][2]
#Preview or not....
if preview:
xlApp.Visible=1
#Print The Sheet...
xlSht.PrintOut( )
xlApp.Workbooks .Close()
xlApp.Quit()
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?
Thank you in advance!!!
Elias
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.
Code: ( text )
def Create_Analysis _Page(Name,Job, Phone,Month,Ana lysing_Dict,pre view=False):
xlApp = Dispatch ("Excel.Applica tion")
xlWb = xlApp.Workbooks .Open ("C:\\Python25\ \Misthos.xlsx")
xlSht = xlWb.Worksheets (1)
xlSht.Cells(1,2 ).Value=str(Nam e)
xlSht.Cells(2,2 ).Value=str(Job )
xlSht.Cells(3,2 ).Value=int(Pho ne)
xlSht.Cells(5,2 ).Value=str(Mon th)
try:
for i in range (9,40):
xlSht.Cells(i,2 ).Value=Analysi ng_Dict[i-8][0]
xlSht.Cells(i,3 ).Value=Analysi ng_Dict[i-8][1]
xlSht.Cells(i,4 ).Value=Analysi ng_Dict[i-8][2]
except:
pass
xlSht.Cells(41, 4).Value=Analys ing_Dict["Totals"][0]
xlSht.Cells(42, 4).Value=Analys ing_Dict["Totals"][1]
xlSht.Cells(43, 4).Value=Analys ing_Dict["Totals"][2]
#Preview or not....
if preview:
xlApp.Visible=1
#Print The Sheet...
xlSht.PrintOut( )
xlApp.Workbooks .Close()
xlApp.Quit()
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?
Thank you in advance!!!
Elias
Comment