in reply to Re: Word wdDocumentsPath and ActivePrinter
in thread Word wdDocumentsPath and ActivePrinter

$word->Options->{DefaultFilePath}->{wdDocumentsPath} = $path_default;


same output...I don't know if I understand the data structure, but it seems as though it is adding a branch to the original hash...not modifying an existing element?

for instance:
$word->Options->DefaultFilePath->{wdDocumentsPath} = $path_new; ---> output: Can't use an undefined value as a HASH reference at ....


I thought that perhaps it was since I could not have access to regedit, maybe I couldn't modify the registry...but I'm able to modify it within Microsoft Word->options->Save

Not that it matters, but this I've been trying it as console window and within a web application...

Replies are listed 'Best First'.
Re^3: Word wdDocumentsPath and ActivePrinter
by stiller (Friar) on Feb 10, 2008 at 00:09 UTC
    Well, it's not the same output, allthough the net result is the same.

    I'm not very familiar with office automation, but I wonder if you have winword running in this last instance?

    Do you:

    use strict; use warnings; use Win32::OLE; # brings in constants like wdDocumentsPath use Win32::OLE::Const 'Microsoft Word'; $Win32::OLE::Warn = 3; # reports OLE errors my $word = Win32::OLE->GetActiveObject('Word.Application') or Win32::OLE->new('Word.Application', 'Quit'); print "word is not running\n" unless defined $word;

    It's a subtle change in syntax thats needed I guess, but I can't find anything on google or here now that answers your particular question.

    good luck!