http://qs1969.pair.com?node_id=410125


in reply to Win32::OLE Word Macro Conversion

You have

With Options .LocalNetworkFile = False

Now... Options is unqualified which means it belongs to the Application object (VBA assumes this), perl won't... try:

$Word->Options->{LocalNetworkFile}=0; ... $Word->Options->{LabelSmartTags}=0;
(untested!)... HTH - Mark

Replies are listed 'Best First'.
Re^2: Win32::OLE Word Macro Conversion
by offspinner (Initiate) on Nov 24, 2004 at 15:03 UTC
    That's cracked it! Thank you!
Re^2: Win32::OLE Word Macro Conversion
by Jenda (Abbot) on Nov 25, 2004 at 00:46 UTC

    Right. And to "emulate" the with object statement you could do something like this:

    for ($Word->Options) { $_->{LocalNetworkFile}=0; $_->{LabelSmartTags}=0; }
    or
    { my %opt = ( LocalNetworkFile => 0, AllowFastSave => 1, BackgroundSave => 1, CreateBackup => 0, SavePropertiesPrompt => 0, SaveInterval => 10, SaveNormalPrompt => 0, DisableFeaturesbyDefault => 0, ); map $Word->Options->{$_} => $opt{$_}, keys %opt; }

    Jenda
    We'd like to help you learn to help yourself
    Look around you, all you see are sympathetic eyes
    Stroll around the grounds until you feel at home
       -- P. Simon in Mrs. Robinson

      That's Just Dandy. Thanks again!

        Actually it can be even neater. Win32::OLE provides a function with() that would let you do this:

        use Win32::OLE qw(with); ... with($Word->Options, LocalNetworkFile => 0, AllowFastSave => 1, BackgroundSave => 1, CreateBackup => 0, SavePropertiesPrompt => 0, SaveInterval => 10, SaveNormalPrompt => 0, DisableFeaturesbyDefault => 0, );
        I forgot about it when writing that node.

        Jenda
        We'd like to help you learn to help yourself
        Look around you, all you see are sympathetic eyes
        Stroll around the grounds until you feel at home
           -- P. Simon in Mrs. Robinson