Seite 1 von 1

VBScript Code -> Python

Verfasst: Freitag 27. Mai 2005, 13:35
von yuppie
Hallo,

hat jemand eine Ahnung, wie man diesen VBScript Code zu Python (Pywin32) übersetzt ?

Code: Alles auswählen

Set oWord = CreateObject("Word.Application")
oWord.WordBasic.FilePrintSetup Printer:="MyPrintername", _DoNotSetAsSysDefault:=1
Ich würde das eigentlich so machen:

Code: Alles auswählen

import win32com.client

app = win32com.client.Dispatch('Word.Application')
app.WordBasic.FilePrintSetup(Printer='MyPrintername', DoNotSetAsSysDefault:=1)
Die letzte Zeile schlägt aber fehl ?! Weil FilePrintSetup vom Typ 'NoneType' ist und nicht aufrufbar ist.

Edit (Leonidas): Code in Python-Tags gesetzt.

Verfasst: Samstag 28. Mai 2005, 07:29
von Leonidas
Ich würde mal das DoNotSetAsSysDefault von der 1 mit einem '=' trennen, statt ein ':=' zu nutzen...