Re: pywin can not access excel file
Dennis Lee Bieber <[email protected]> Mon, 13 Dec 2021 07:34:18 -0500
| Newsgroups | gmane.comp.python.windows |
|---|---|
| Organization | IISS Elusive Unicorn |
| Message-ID | <[email protected]> |
On Sun, 12 Dec 2021 08:32:01 +0000, Tamara Abugharbieh <[email protected]> declaimed the following: >filename = 'C:\\\\App\\\\Backend\\\\public\\\\MSB_2021\\\\11\\\\SYB_10_7_V1.xlsx' > That looks like an awful lot of \s. Unless you are passing that string to a command line/shell, the Windows API itself is happy with single /s (which avoids any problem of needing to escape \s to avoid some combos being treated as special characters). >ExcelApp = w3c.DispatchEx("Excel.Application") >ExcelApp.Visible = False >ExcelApp.DisplayAlerts = False >wb = ExcelApp.Workbooks.Open("{0}".format(fileName)) As has been mentioned, filename and fileName aren't the same entity (though the error message does reference the string you provided, so something is not the code you actually ran). -- Wulfraed Dennis Lee Bieber AF6VN [email protected] http://wlfraed.microdiversity.freeddns.org/