Load Excel add-in using win32com from Python

后端 未结 3 572
野的像风
野的像风 2021-02-09 20:47

I\'ve seen from various questions on here that if an instance of Excel is opened from Python using:

xl = win32com.client.gencache.EnsureDispatch(\'Excel.Applicat         


        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-09 21:01

    I have had much better success using Excel via win32com than any of the other methods, but you might want to look at pyxll (https://www.pyxll.com/introduction.html). Here are a few other things:

    • Have you checked that addin.Installed == True?
    • Have you tried AddIns.Add("c:\windows\addins\TSXL\TSXL.xll").Installed = True?
    • Try xl.DisplayAlerts=False before opening the workbooks
    • Have you tried the four steps in last answer of Automating Excel via COM/Python - standard addins won't load at startup, I copy them here:

      1. Open the XLA / XLL file representing the addin in question
      2. Set addins(addin_name).Installed = False
      3. Addins(addin_name).Add(addin_file_path)
      4. Set addins(addin_name).Installed = True

提交回复
热议问题