更新时间:2023-02-26 18:57:18
尝试导入 time 并将 time.sleep(2) 放在每个命令之后.我发现彭博链接有时需要一秒钟才能更新.
Try importing time and putting time.sleep(2) after each command. I found the Bloomberg links sometimes need a second to update.
xlapp = win32com.client.DispatchEx("Excel.Application")
time.sleep(2)
xlapp.RegisterXLL('C:/blp/API/Office Tools/bofaddin.dll')
time.sleep(2)
xlapp.Workbooks.Open('C:\\blp\\API\\Office Tools\\BloombergUI.xla')
time.sleep(2)
wb = xlapp.Workbooks.Open(filepath,None,False)
xlapp.Visible = True
wb_addin = ('C:/blp/API/Office Tools/bofaddin.dll')