Named parameters to methods get a Python = not a VBA :=.Add gets parentheses because functions in Python have to have them (VBA methods don't). So the Python code follows the VBA exactly, except for syntax. The objects that win32com gets from Excel are not Python objects: they are thin Python wrappers around VBA objects, and these VBA objects follow their own conventions, not Python's. The lines that set up the validation follow exactly the example in the reference given in my comment. xl.Visible = 1 will just show a screen flicker. Xl.Visible = 0 # Not really such fun to watch because the code below closes down Excel Taking just the code inside your try.except clause, that would look like this: xl = Dispatch("Excel.Application") So you need to set attributes of the object ws.Cells(6,1).Validation. (Or rather, attempting to set it: that line contains two syntax errors, one in the quoting and one in the comment.)īut you don't want to set the value of the cell, you want to apply validation to the cell. Is setting the value of the cell, just like the previous lines did. What you are doing isn't working because this line ws.Cells(6,1).Value = "" //I want drop down here
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |