John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

The call to GoTo produces Win32::OLE(0.1501) error 0x80020011: "Does not support a collection" in METHOD/PROPERTYGET "" at ...

Huh?

The last line works (as do others not shown) so I clearly have a Document object at this point. What's wrong with the method call GoTo?

And if that line didn't work, why don't the next two cause errors as well?

my $Doc= Win32::OLE->GetObject ($filename, 'Close' ); my $range= $Doc->GoTo ($wd->{wdGoToBookmark}, { Name => 'Functionalit +yMatrix' }); $range->InsertParagraphBefore(); $range->InsertBefore ('Hello world!'); print "** $Doc $Doc->{FullName}\n";

Replies are listed 'Best First'.
(tye)Re: Win32::OLE strange error message
by tye (Sage) on Jul 27, 2001 at 23:43 UTC

    I don't know much about Win32::OLE, but I suspect that the error is coming from $wd->{wdGoToBookmark} and not the call to GoTo() itself.

    Update: I thought that "The call to GoTo produces" was not part of the error message (especially since it isn't italicized) and didn't see "GoTo" mentioned in the rest of the error. I'm glad it is working now.

            - tye (but my friends call me "Tye")
      I don't think so, since the error message specifically refers to "GoTo", and $wd is an ordinary hashref.

      FWIW, it stopped happening. Go figure.