You can't use new in Win32::OLE, all objects are accessed dynamically (i.e. late bound). You'd do it like you would in VB Script, with CreateObject.
With that said, I'm not sure you can instantiate a ParagraphFormat object with CreateObject - I've never tried. You can always try, but I'd use these properties directly from the Paragraph object. So for your VB example: ActiveDocument.Paragraphs(1).Format.Alignment = wdAlignParagraphCenter ActiveDocument.Paragraphs(1).Format.Borders.Enable = True A quick search on google found http://www.adp-gmbh.ch/perl/word.html, which has some really good examples. HT -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of beau Sent: Tuesday, February 08, 2005 8:28 AM To: [email protected] Subject: Win32::OLE using New Hi - I'm using Win32::OLE to create/manipulate MW Word documents. I have just one problem: how do I create a new DOM object? For example, I want to create a new ParagraphFormat object. In VB I would do something like this: Dim myParaF As New ParagraphFormat myParaF.Alignment = wdAlignParagraphCenter myParaF.Borders.Enable = True ActiveDocument.Paragraphs(1).Format = myParaF I have tried: my $pf = Win32::OLE->new( 'ParagraphFormat' ); but that doesn't work. I guess I'm asking for the Win32::OLE equivalent of the VB 'New' keyword. Can anyone help? Aloha => Beau; -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.6 - Release Date: 2/7/2005 _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
