On Friday, January 15, 2016 at 2:04:08 PM UTC+8, tdsp...@gmail.com wrote: > Hi All > > I am trying to change the active printer using win32com.client with the > following code > > > > wordapp = win32com.client.Dispatch('Word.Application') > worddoc = wordapp.Documents.Open(mypathfile) > print(wordapp.ActivePrinter) > "\\server\queries" > wordapp.ActivePrinter = "\\server\letters" //fails on this line > > > File "C:\Anaconda3\lib\site-packages\win32com\client\dynamic.py", line 544, > in __setattr__ > self._oleobj_.Invoke(entry.dispid, 0, invoke_type, 0, value) > pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft > Word', 'There is a printer error.', 'wdmain11. > chm', 24696, -2146823072), None) > > If I don't try to change printers - it prints too the default printer. > > Cheers > > Colin
\\\\server\\letters - the extra back slashes were required. Colin -- https://mail.python.org/mailman/listinfo/python-list