On Fri, 13 Oct 2000 14:35:12 +0200, Klaas Tanis <[EMAIL PROTECTED]>
wrote:
>Can anybody explain how I can add a custom property?
The following code works for me:
#-------------------------------------------------------------------
use strict;
use Win32::OLE qw(in);
use Win32::OLE::Const 'Microsoft Office';
my $Doc = Win32::OLE->GetObject('i:\tmp\test.doc');
$Doc->CustomDocumentProperties->Add({
Name => "My first custom property",
LinkToContent => 0,
Type => msoPropertyTypeString,
Value => "Yeah right, the value"
});
$Doc->Save;
foreach my $Property (in $Doc->CustomDocumentProperties) {
my $Name = $Property->Name;
local $Win32::OLE::Warn = 0;
my $Value = $Property->Value;
$Value = '***Error***' if Win32::OLE->LastError;
$Value = '<undef>' unless defined $Value;
printf "%s %s = %s\n", $Name, '.' x (40-length($Name)), $Value;
}
#-------------------------------------------------------------------
Sorry, I don't have any time to figure out why yours doesn't work; the
error message definitely looks confusing.
-Jan
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users