Strange problem with win32 (WinWord Automotion).

vtail vtail at yandex.ru
Wed Aug 14 12:37:51 CEST 2002


Greetings.

Can someone please help me with win32-related problem? I've following
obvious test script:
----
import win32com.client
from win32com.client import Dispatch

wdGoToHeading = 0

def f1(filename):
    W = Dispatch("Word.Application")
    W.Visible = 0
    wdGoToHeading = win32com.client.constants.wdGoToHeading

    W.Documents.Open(filename)
    D = W.Documents[0]
    R = D.Range()
    print "R start & end", R.Start, R.End
    R1 = R.GoTo(wdGoToHeading)
    print "R1 start & end", R1.Start, R1.End

    f2(R)

def f2(R):
    print "f2 R start & end", R.Start, R.End
    R1 = R.GoTo(wdGoToHeading)
    print "f2 R1 start & end", R1.Start, R1.End

if __name__=="__main__":
    f1(r"o:\_public\_publishing\_mcomment\mc020821.doc")
----

and it returns following lines:

----
R start & end 0 41773
R1 start & end 2617 2617
f2 R start & end 0 41773
f2 R1 start & end 0 0
----

- that looks quite strange. Do you have any ideas about it?

Thanks a lot, Victor.



More information about the Python-list mailing list