Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

There is another way to get to the Word-constants, which in my experience is more stable, when there are many constants, as there indeed are in Word.

I would like to encourage you to try this instead to see if it helps:
use Win32::Shortcut; use Win32::OLE qw(in with); use Win32::OLE::Const; ##=>Changed my $wdc = Win32::OLE::Const->Load("Microsoft Word"); ##=>Added my $x = Win32::OLE->GetActiveObject('Word.Application'); # snip $x->Selection->Delete( { Unit=> $wdc->{wdCharacter}, ##=>Changed Count=>1 } );

Searching through some old email conversations with jand, the author/maintainer of Win32::OLE, from 2002 I found this.

>>Another feature is that standard way to handle wdCONSTANTS >> >>use Win32::OLE::Const 'Microsoft Word'; >> >>does not work anymore, I resorted to >> >>use Win32::OLE::Const; >>.... >> $obj->{_WD} = Win32::OLE::Const->Load("Microsoft Word"); # 9.0 Obje +ct >>Library"); > > Hmm, do you get any errors or anything? > "Constant subroutine emptyenum redefined at C:/DEV/Perl/site/lib/Win32/OLE/Const. pm line 65535." times 13 (Bad luck ??)

Nothing new under the sun, it seems. But the indicated way works.

Notice that your erroneous linenumber is -1 whereas mine is 65535, 16 bit integers or what?


In reply to Re: 'emptyenum' error w/ use Win32::OLE::Const 'Microsoft Word' by guha
in thread 'emptyenum' error w/ use Win32::OLE::Const 'Microsoft Word' by ff

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (6)
    As of 2018-04-24 14:11 GMT
    Find Nodes?
      Voting Booth?