简体   繁体   中英

How to F9 Excel book using Python?

I tried to adapt VBA examples from How do you get Excel to refresh data on sheet from within VBA? , they do not work: sheet.Calculate does nothing, other versions of calculate cannot be found...

Adding a CalculateFull macro progrmmatically and calling it solves the problem, but looks convolutive ...

xlmodule = book.VBProject.VBComponents.Add(1) # http://support.microsoft.com/kb/282830 if this line throws an error
xlmodule.CodeModule.AddFromString('Public Sub AnotherCalculateFull() \n\
                                               Application.CalculateFull \n\
                                               End Sub')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM