Discussion:
Running Word and Macros from an "at" job
(too old to reply)
unknown
2006-09-09 16:30:09 UTC
Permalink
Windows XP SP2, Word 2000.

I've been trying to convert Word docs to PDF automatically, and
unattended. I wrote macros to manage the docs and invoke the Adobe
Acrobat 6.0 PDF-conversion feature. The Public entrypoint to my
macros is called "MergeToPDF".

I'm using a perl script similar to the one on this page:

http://www.windowsdevcenter.com/pub/a/windows/2005/03/22/word_macros.html?CMP=ILC-KT7751768473&ATT=1364

The perl script invokes my macro "MergeToPDF" after starting Word and
Opening the doc.

I have a .bat file that invokes the perl script.

When I run the .bat from the command line, everything works just fine.

When I run the .bat as an "at" job, it's as if the macros aren't
loaded. I get these messages:

OLE exception from "Microsoft Word":
Unable to run the specified macro
Win32::OLE(0.1704) error 0x80020003: "Member not found"
in METHOD/PROPERTYGET "Run" at c:\autopdf.pl line 45

I keep the macro in its own .dot file in ...\Word\STARTUP, but this
behavior also happens when I move the macro code to Normal.dot.

It's as if Normal.dot and the add-ins aren't loaded when Word is run
in the "background".

Can this be made to work?

-Christopher Allen
christopher.allen at workscape dot NOSPAM dot com
unknown
2006-09-11 17:19:03 UTC
Permalink
I did some more experimenting on this, by adding in some of the
templates I need, something like this:

$wrd->{'AddIns'}->Add('C:\USERDIR\Application
Data\Microsoft\Word\STARTUP\AutoPDF.dot',1);

but I'm getting errors like these:

Win32::OLE(0.1704) error 0x800706be: "The remote procedure call failed"
in METHOD/PROPERTYGET "Run" at c:\USERDIR\test\perl\autopdf.pl line 70
Win32::OLE(0.1704) error 0x800706ba: "The RPC server is unavailable"
in METHOD/PROPERTYGET "" at c:\USERDIR\test\perl\autopdf.pl line 75


Anyone have any ideas?

-Christopher Allen
unknown
2006-09-12 18:37:52 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...