esr has asked for the wisdom of the Perl Monks concerning the following question:
The Open fails because $word is not defined. Similar code for Excel still works fine.$word = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application'); $mydoc = $word->Documents->Open($xfile);
The boilerplate at the beginning of the program contains:
use Win32; use Win32::OLE; use Win32::OLE "with"; use Win32::OLE::Const 'Microsoft Excel'; use Win32::OLE::Const 'Microsoft Word'; use Win32::OLE::Const 'Visual Basic For Applications'; use Win32::OLE::Variant;
It appears that something has changed on this machine but I don't know what to look for. I recently had some problems with my virus checking program for which the "fix" caused some registry problems for I.E. but AFAIK fixing those did not affect anything else.
I have also tried using CreateObject and GetObject but they do not return an object reference either. Is there something in the OLE stuff that gets registered that may have gotten unregistered? Any ideas of what I should look for?
Addendum: When I set Win32::OLE::Warn=2 I get the error message that I have an "Invalid Class String".
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Win32::OLE create object failing
by gellyfish (Monsignor) on Sep 10, 2006 at 07:59 UTC | |
by esr (Scribe) on Sep 11, 2006 at 14:47 UTC |