Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

What is the perl equivalent of vba

by Anonymous Monk
on Jan 31, 2005 at 10:39 UTC ( [id://426546]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:


What is the perl equivalent of vba code line 1

0: dim str as string, Rng as range 1: str
I tried to use as follows
$str = $rng->{style}

But it returns an hash. im trying to get the style name of the range object

Pls help

Replies are listed 'Best First'.
Re: What is the perl equivalent of vba
by thinker (Parson) on Jan 31, 2005 at 10:50 UTC

    Hi there,

    Ok, I am assuming you have an object, $rng, of some type, and it has a style() method, you can call it by  $str = $rng->style();



      Really, the previous code is correct. The instance variable of the object is accessed in these form, or

      $str = $$rng{style};

Re: What is the perl equivalent of vba
by maa (Pilgrim) on Jan 31, 2005 at 15:35 UTC

    Since each Office Application has its own API you'll need to tell us if this is Word, Excel or PowerPoint... then we'll maybe be able to help.

Re: What is the perl equivalent of vba
by gube (Parson) on Feb 01, 2005 at 04:59 UTC

    Hi, try this with OLE module

    Please open the word document and use this

    use Win32::OLE; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Word'; $word=Win32::OLE->GetActiveObject('Word.Application'); $doc= $word->activedocument; foreach my $val (in $doc->styles){ push @styles,$val->{namelocal}; } $"="\n"; print "@styles";


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://426546]
Approved by Corion
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-24 23:00 GMT
Find Nodes?
    Voting Booth?

    No recent polls found