Hello,

I have a Windows VM running in Azure cloud, which is connected to File
Shares. I have created a Python script which downloads the excel files from
the file shares, executes macros and copies the files back. I am able to
get this working with a "foreground" task, i.e. launching the script when
logged on. However I need to automate launching of the script in case that
the VM is restarted, for this I am using Task Scheduler.

Task Scheduler works when running in the foreground, but when I select the
option "run whether user is logged on or not" I receive the following error
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft
Excel', "Microsoft Excel cannot access the file
'C:\\AMS\\temp_dir\\Auftragsnummernliste.xlsm'. There are several possible
reasons:\n\n• The file name or path does not exist.\n• The file is being
used by another program.\n• The workbook you are trying to save has the
same name as a currently open workbook.", 'xlmain11.chm', 0, -2146827284),
None) from this line of code excel_macro.Workbooks.Open(Filename=file_path,
ReadOnly=1)

Is there a way to open the excel file in the background or do I have to
find some other workaround (e.g. alerting the admin that the VM was
restarted).
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to