Load Excel add-in using win32com from Python

后端 未结 3 531
野的像风
野的像风 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:12

    I have actually managed to resolve this by borrowing something from this MSDN article relating to doing the same thing with VBA:

    http://support.microsoft.com/default.aspx?scid=KB;en-us;q213489

    The following now works perfectly:

    xl = win32com.client.gencache.EnsureDispatch('Excel.Application')
    xl.Visible = True
    xl.RegisterXLL('C:/path/addin.xll')
    wb = xl.Workbooks.Open('Test.xlsx')
    

提交回复
热议问题