Python And MS Word Com Server
jh at cddk.dk
Mon Dec 4 08:10:16 EST 2000
I have exactly the same problem, but no solution, unfortunately.
I think there must be a bug in win32com. The problem seems to arise when you
use keyword arguments. If you do not use keyword arguments, and instead
supply the arguments in the right sequence, it works. (I cannot test the
code below though, as I haven't access to Word 8 or above).
The problem with this "solution" is that you cannot omit arguments before
the arguments you want to supply to the function, so you have to supply the
default values explicitly for the arguments that should just take default
values, and which are placed before the arguments you want to supply. This
could be OK, but sometimes you cannot supply a default value explicitly to
Word, because sometimes the only way to tell Word to use the default value
of an argument is to omit the argument.
I tried looking in the source code for win32com for bugs, but it was too
complicated to understand in the limited time I had.
Does anyone have a solution to this?
Forlaget Magnus A/S
"Ralf Claus" <ralf.claus at t-online.de> wrote in message
news:90bc4c$rhr$02$1 at news.t-online.com...
> i have one special problem with the Word COM server !
> import win32com.client
> msw = win32com.client.Dispatch("Word.Document")
> msw.Application.PrintOut(OutputFileName = "D:\\test.prn",
> The COM Server ignore the given filename, and the PrintToFile method .
> What ever i try, it was printed by the system standard printer!
> The same code in a VB macro in word works fine
> What's wrong?
More information about the Python-list