Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

calling Word Macros through tcom package for tcl

57 views
Skip to first unread message

Kathy Rathy

unread,
Apr 8, 2002, 5:10:52 PM4/8/02
to
I'm using the tcom package for tcl to access COM objects. I need to
run a macro on a word document. Here's example code:

package require tcom
set application [::tcom::ref createobject "Word.Application"]
set documents [$application Documents]
set document [$documents Open test1.doc]
set docApp [$document Application]
$docApp Run Macro1
$application Quit

When I do the $docApp Run Macro1, I get the error: "Error: 0x80020003
{Unable to run the specified macro}".

Is this a tcl syntax error or an error within Word?

Thanks in advance,
Kathy R

Chin Huang

unread,
Apr 8, 2002, 7:24:32 PM4/8/02
to
In article <85bfe9ce.02040...@posting.google.com>,

Kathy Rathy <kathy...@scimus.com> wrote:
>I'm using the tcom package for tcl to access COM objects. I need to
>run a macro on a word document. Here's example code:
>
>$docApp Run Macro1

>
>When I do the $docApp Run Macro1, I get the error: "Error: 0x80020003
>{Unable to run the specified macro}".
>
>Is this a tcl syntax error or an error within Word?

The error is from Word. You may have to correctly path the macro with
the project and module containing the macro. For example,

$docApp Run Project.MyModule.Macro1

Kathy Rathy

unread,
Apr 9, 2002, 9:41:22 AM4/9/02
to
> The error is from Word. You may have to correctly path the macro with
> the project and module containing the macro. For example,
>
> $docApp Run Project.MyModule.Macro1

Thanks for the reply. The macro I was trying to run resides in a
template document. I found I needed to open this template as well as
the document I wanted to run the macro against.

0 new messages