<?xml version="1.0" encoding="windows-1252"?>
<node id="435889" title="Re: 'emptyenum' error w/ use Win32::OLE::Const 'Microsoft Word'" created="2005-03-02 10:57:06" updated="2005-08-13 08:57:11">
<type id="11">
note</type>
<author id="111406">
guha</author>
<data>
<field name="doctext">
&lt;p&gt;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.&lt;/P&gt;

I would like to encourage you to try this instead to see if it helps:
&lt;code&gt;
use Win32::Shortcut;
use Win32::OLE qw(in with);
use Win32::OLE::Const; ##=&gt;Changed

my $wdc = Win32::OLE::Const-&gt;Load("Microsoft Word"); ##=&gt;Added

my $x = Win32::OLE-&gt;GetActiveObject('Word.Application');

# snip

$x-&gt;Selection-&gt;Delete( {
          Unit=&gt; $wdc-&gt;{wdCharacter}, ##=&gt;Changed
          Count=&gt;1
     } );
&lt;/code&gt;
&lt;p&gt;Searching through some old email conversations with [jand], the author/maintainer of Win32::OLE, from 2002 I found this.&lt;/P&gt;
&lt;code&gt;
&gt;&gt;Another feature is that standard way to handle wdCONSTANTS
&gt;&gt;
&gt;&gt;use Win32::OLE::Const 'Microsoft Word';
&gt;&gt;
&gt;&gt;does not work anymore, I resorted to
&gt;&gt;
&gt;&gt;use Win32::OLE::Const;
&gt;&gt;....
&gt;&gt; $obj-&gt;{_WD} = Win32::OLE::Const-&gt;Load("Microsoft Word"); # 9.0 Object
&gt;&gt;Library");
&gt;
&gt; Hmm, do you get any errors or anything?
&gt;
"Constant subroutine emptyenum redefined at
C:/DEV/Perl/site/lib/Win32/OLE/Const.
pm line 65535."  times 13 (Bad luck ??)
&lt;/code&gt;

&lt;p&gt;Nothing new under the sun, it seems. But the indicated way works.&lt;/p&gt;

&lt;p&gt;Notice that your erroneous linenumber is -1 whereas mine is 65535, 16 bit integers or what?&lt;/P&gt; 

&lt;p&gt;HTH&lt;/p&gt;</field>
<field name="root_node">
435825</field>
<field name="parent_node">
435825</field>
</data>
</node>
