[yeswanty devi] | Hello all, | if we have number of excel sheets in a workbook.can | we access a selected sheet in the workbook. when i try to | acces it always goes to the last sheet.
I assume this is the kind of thing you want: (somewhat exaggerated example, but ...) <code> import os import win32com.client xl = win32com.client.Dispatch ("Excel.Application") # # Create a new workbook with a default # number of sheets (probably 3) # wb = xl.Workbooks.Add () print wb.Sheets.Count sheet0 = wb.Sheets[0] sheet1 = wb.Sheets[1] sheet2 = wb.Sheets[2] sheet0.Name = "First sheet" sheet1.Name = "Second sheet" sheet2.Name = "Third sheet" wb.SaveAs (Filename="c:\\temp\\test.xls") wb.Close () xl.Quit () os.startfile ("c:\\temp\\test.xls") </code> TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. 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 ________________________________________________________________________ _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32