How to set Excel option button value (via python)?
Hey there,
I'm writing a python plugin for a geo referencing program called QGIS where I want an Excel sheet to do all my calculations for me. For different data points I need to set certain input values into the spreadsheet (which was already written by someone else). I'm fine setting the simple int values (using win32com.client) with sheet.Cells(row, col).Value = value Setting an option button value, I'd expect (and thinnk I read somewhere) to go like so: sheet.opt_name.Value = Tru开发者_C百科e but the console keeps returning (though opt_name exists and is used in VB) "AttributeError: '' object has no attribute 'opt_name'"
Any ideas what's could be wrong with that? Am I on the right track? Is is even possible to do via python or do I need to dive into VB? Thanks!
You need to refer to the option button as a shape on the sheet
I don't know how you access the excel object model in python, but in vb it's something like
YourSheetObject.Shapes("opt_name").Value = 1
精彩评论