Hi,

We are using winpy32 to automate excel applications using python. The python 
script will be used by users with no administrator privileges, and in this 
case, we are getting the following error:
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft 
Excel', \"Microsoft Excel cannot access the file 
'C:\\\\App\\\\Backend\\\\public\\\\MSB_2021\\\\11\\\\SYB_10_7_V1.xlsx'. There 
are several possible reasons: The file name or path does not exist. The file is 
being used by another program. The workbook you are trying to save has the same 
name as a currently open workbook.\", 'xlmain11.chm', 0, -2146827284)

Things to note:

  1.  The file does exist
  2.  The file is not being used by another program
  3.  The path is correct
  4.  The python script is being successfully used by users with administrative 
privileges

Please find bellow the method I am using to open the excel file:


import win32com.client as w3c



filename = 
'C:\\\\App\\\\Backend\\\\public\\\\MSB_2021\\\\11\\\\SYB_10_7_V1.xlsx'

ExcelApp = w3c.DispatchEx("Excel.Application")
ExcelApp.Visible = False
ExcelApp.DisplayAlerts = False
wb = ExcelApp.Workbooks.Open("{0}".format(fileName))

Appreciate your help.

Best,
Tamara

_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to