Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >Traceback (most recent call last):
- File"mypathtopythonprogram", line 19, in <modlule>
- xl.Application.Run('main')
- File"mypathAppDataLocalTempgen_py3.7 0020813-0000-0000-C000-000000000046x0x1x9_Application.py", line 376, in Run
- , Arg26, Arg27, Arg28, Arg29, Arg30
- File"mypathAppDataLocalProgramsPythonPython37-32libsite-packageswin32comclient__init__.py", line 467, in _ApplyTypes_
- self._oleobj_.InvokeTypes(dispid, 0, wFlags, retType, argTypes, *args),
- pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146788248), None)
- import win32com.client
- import win32com
- import os, os.path
- xl = win32com.client.gencache.EnsureDispatch("Excel.Application")
- xl.Workbooks.Open(Filename=r"mypathDesktopWorksWithPy.xlsm")
- xl.Visible = True
- xl.Workbooks(1).Worksheets(1).Cells(4, 7).Value = r"17639d0c-2007-4a68-a0fd0b615d6f8fed"
- xl.Workbooks(1).Worksheets(1).Cells(7, 7).Value = r'\localserveraddress'
- xl.Application.Run(r'main')
- xl.Workbooks(1).SaveAs(Filename=r'mypathDesktopsameFileButWithDesiredResults.xlsm', FileFormat=52)
- xl.Workbooks(1).Close(0)
- xl.Quit()
Add Comment
Please, Sign In to add comment