Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import win32com.client
- xlApp = win32com.client.DispatchEx('Excel.Application')
- xlApp.Visible = True
- objWkb = xlApp.Workbooks.Add()
- objSht = objWkb.Worksheets(1)
- objSht.Cells(2,2).Value = '1'
- objSht.Cells(2,3).Value = '2'
- range = objSht.Cells(2,4)
- range.Value = '=%s+%s' % (objSht.Cells(2,2).Address, objSht.Cells(2,3).Address)
- range.AddComment('Test Comment')
- print range.Address
- print range.Address(RowAbsolute=False, ColumnAbsolute=False)
- objWkb.Close(SaveChanges=False) #to avoid prompt
- xlApp.Quit()
- xlApp.Visible = 0 #must make Visible=0 before del self.excelapp or EXCEL.EXE remains in memory.
- del xlApp
- range.GetAddress(RowAbsolute=False,ColumnAbsolute=False)
- range.GetAddress()
- range.Address
Add Comment
Please, Sign In to add comment