Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Win32::OLE + word page count

by Rudif (Hermit)
on Aug 15, 2001 at 01:51 UTC ( #104892=note: print w/replies, xml ) Need Help??


in reply to Win32::OLE + word page count

Hi gwhite

The script below works for me.
If you are tempted by VB/Word programming :-(, this site offers some guidance.
#!perl -w use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; #my $wd = Win32::OLE::Const->Load("Microsoft Word 10.0 Object Library" +); my $wd = Win32::OLE::Const->Load("Microsoft Word 9.0 Object Library"); my $Word = Win32::OLE->new('Word.Application', 'Quit'); #$Word->{'Visible'} = 1; # if you want to see what's going on my $doc = $Word->Documents->Open("C:\\temp\\test.doc") || die("Unable to open document ", Win32::OLE->LastError()); my $sel = $Word->Selection; $sel->WholeStory; my $pages = $sel->Information($wd->{'wdNumberOfPagesInDocument'}) || d +ie("Unable to open property ", Win32::OLE->LastError()); print "The number of pages in test.doc are: $pages\n";
HTH
Rudif

Replies are listed 'Best First'.
Re: Re: Win32::OLE + word page count
by softworkz (Monk) on Aug 15, 2001 at 20:54 UTC
    HEY THAT IS SLICK!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://104892]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2023-12-11 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?