wb5.SaveAs(fname2+"x", FileFormat = 51) #FileFormat = 51 is for .xlsx extension
wb.Close()
wb5.Close() #FileFormat = 56 is for .xls extension
excel.Application.Quit()
excel2.Application.Quit()
print('File .xls convert .xlsx successful!!')
复制代码
这是错误显示:
Traceback (most recent call last):
File "c:/Users/shenshuaic/Desktop/SFP Program/win32test.py", line 10, in <module>
import win32com.client as win32
File "C:\Users\shenshuaic\AppData\Local\Continuum\anaconda3\lib\site-packages\win32com\__init__.py", line 5, in <module>
import win32api, sys, os
ImportError: DLL load failed: The specified procedure could not be found.
I have the same problem for days, but one day I solved it.
After you installed the pywin32 libs, there is a directory "Lib/site-packages/pywin32_system32", which including three dll libs, copy them to the "/Lib/site-packages/win32" directory, which including the win32api.pyd or win32api.pyc.
There will be no ImportError Exception any more