When saving msword document after adjusting the custom properties you MUST set the Saved flag : see http://support.microsoft.com/kb/195425/en-us

without it it won't be saved.......

use strict; use Win32::OLE qw(in); use Win32::OLE::Const 'Microsoft Office'; #my ( $doc ) = Win32::OLE->GetObject('D:/4nt8/perl-msword_dap/excel_da +p/Inrichting Arag-ftp.doc'); my ( $doc ) = Win32::OLE->GetObject('//vldfps1/algemeen/FM&O/Klanten/S +-t/TESTING/Dap Dossier/01. Dap/FBL.OPR.UX.138 WI Inloggen, shutdown e +n reboot van LPAR AIX systemen m.b.v. de HMC en PTY.doc'); my $property = 'Arno'; my $value = 'KranenDONK'; my $docprops = $doc->CustomDocumentProperties(); unless (defined ($doc->CustomDocumentProperties($property))) { $docprops->Invoke('Add', { Name => $property, LinkToContent => 0, Type => 4, #msoPropertyTypeString #strictures to work around still Value => $value, }); } $doc->CustomDocumentProperties($property)->{Value} = $value; $doc->{Saved} = 0; # SEE : http://support.microsoft.com/kb/195425 en + http://compgroups.net/comp.lang.perl.misc/how-read-ms-word-summary-p +roperties/477092 $doc->Save; $doc-> Close;

Hope somebody will find this quicker then I did....


In reply to Re: Adding MSWord custom properties in Win32::OLE by teun-arno
in thread Adding MSWord custom properties in Win32::OLE by thoglette

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.