win32::OLE

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • user1357
    New Member
    • Mar 2008
    • 4

    win32::OLE

    Hi all,

    i am trying to run the following code


    Code:
    use strict;
    use Win32::OLE qw(in with);
    use Win32::OLE::Const 'Microsoft Excel';
    $Win32::OLE::Warn = 3;                                # die on errors...
    my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
        || Win32::OLE->new('Excel.Application', 'Quit');  # get already active Excel
                                                          # application or open new
    my $Book = $Excel->Workbooks->Open("C:\\DOCUMENTS\\test.xls"); # open Excel file
    my $Sheet = $Book->Worksheets(1);                     # select worksheet number 1
    $last_row = $sheet -> UsedRange -> Find({What => "*", SearchDirection => xlPrevious, SearchOrder => xlByRows}) -> {Row};
    my $array = $Sheet->Range("A4:B$last_row")->{'Value'};        # get the contents
    $Book->Close;
    i am getting the following error

    Win32::OLE object version 0.1701 does not match $Win32::OLE::VE RSION 0.1703 at C
    :/Perl/lib/DynaLoader.pm line 185.
    Compilation failed in require at C:\OLE\ole.pl line 2.
    BEGIN failed--compilation aborted at C:\OLE\ole.pl line 2.

    can anybody tell me what this error means?

    Thnaks in advance.
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Originally posted by user1357
    Hi all,

    i am trying to run the following code


    Code:
    use strict;
    use Win32::OLE qw(in with);
    use Win32::OLE::Const 'Microsoft Excel';
    $Win32::OLE::Warn = 3;                                # die on errors...
    my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
        || Win32::OLE->new('Excel.Application', 'Quit');  # get already active Excel
                                                          # application or open new
    my $Book = $Excel->Workbooks->Open("C:\\DOCUMENTS\\test.xls"); # open Excel file
    my $Sheet = $Book->Worksheets(1);                     # select worksheet number 1
    $last_row = $sheet -> UsedRange -> Find({What => "*", SearchDirection => xlPrevious, SearchOrder => xlByRows}) -> {Row};
    my $array = $Sheet->Range("A4:B$last_row")->{'Value'};        # get the contents
    $Book->Close;
    i am getting the following error

    Win32::OLE object version 0.1701 does not match $Win32::OLE::VE RSION 0.1703 at C
    :/Perl/lib/DynaLoader.pm line 185.
    Compilation failed in require at C:\OLE\ole.pl line 2.
    BEGIN failed--compilation aborted at C:\OLE\ole.pl line 2.

    can anybody tell me what this error means?

    Thnaks in advance.

    Sorry, I don't know the answer but hopefully one of our experts will be able to assist you.

    My appologies for the delay in getting an answer to your question.

    Regards,

    Jeff

    Comment

    Working...