Everything but the column: win32::OLE Excel fun

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default Everything but the column: win32::OLE Excel fun

    This doesn't print out anything. I want it to print the desired
    range I selected in the $array declaration.

    I appreciate any insights!

    Thanks,

    -Phil

    /////////////////////////////


    use Win32::OLE;

    eval {$Excel = Win32::OLE->GetActiveObject('Excel.Application')};
    die "Excel not installed" if $@;
    unless (defined $ex) {
    $Excel = Win32::OLE->new('Excel.Application', sub
    {$_[0]->Quit;})
    or die "Oops, cannot start Excel";
    }
    $Excel = Win32::OLE->GetActiveObject('Excel.Application');

    $Book = $Excel->Workbooks->Open('C:\Documents and
    Settings\pvernes\Desktop\CDS CORRELATOIN
    PROJECT\Ford_equity_cds_data2.xls'); # open Excel file

    $Sheet = $Book->Worksheets(1); # select worksheet
    number 1
    $array = $Sheet->Range('AA6:AA508')->{value}; # get the contents

    $Book->Close;

    foreach $array (@array) {
    print $array;

    }

    Phil Guest

  2. Similar Questions and Discussions

    1. How to create or modify an Excel file with embedded charts w/o Win32::OLE?
      I am creating a web application that creates custom excel workbooks containing embedded charts for users to download. I know Win32::OLE can do...
    2. Win32-OLE excel cell reference.
      Guys, I'm struggling with the syntax to point to the cells that I want to use in Excel. It seems that the Range command likes data like (A14),...
    3. Win32::OLE, Excel and OLE Automation question
      "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu> wrote in message news:<Xns93B9985BBBFFasu1cornelledu@132.236.56.8>... Thanks for the reply - I still got...
    4. Win32-OLE, excel, and empties.
      Hello World! I'm trying to find the first empty row in a spreadsheet. If I use this: my $EmptyRow = $sheet->UsedRange->rows->count;...
    5. Win32::OLE, Excel, and coloring
      Hello, I've been using ActiveState's ActivePerl to generate Excel spreadsheets using the Win32::OLE module. The rudimentary examples that are...
  3. #2

    Default Re: Everything but the column: win32::OLE Excel fun

    "Phil" <Philip.Vernes@GfiGroup.com> wrote:
    > use Win32::OLE;
    >
    > eval {$Excel = Win32::OLE->GetActiveObject('Excel.Application')};
    > die "Excel not installed" if $@;
    > unless (defined $ex) {

    $ex?



    --
    John Bokma Freelance software developer
    &
    Experienced Perl programmer: [url]http://castleamber.com/[/url]
    John Bokma Guest

  4. #3

    Default Re: Everything but the column: win32::OLE Excel fun

    Phil wrote:
    > This doesn't print out anything. I want it to print the desired
    > range I selected in the $array declaration.
    >
    > I appreciate any insights!
    >
    > Thanks,
    >
    > -Phil
    >
    > /////////////////////////////
    >
    use strict;
    use warnings;

    # Then fix up the errors you get.
    >
    > use Win32::OLE;
    >
    > eval {$Excel = Win32::OLE->GetActiveObject('Excel.Application')};
    > die "Excel not installed" if $@;
    > unless (defined $ex) {
    > $Excel = Win32::OLE->new('Excel.Application', sub
    > {$_[0]->Quit;})
    > or die "Oops, cannot start Excel";
    > }
    > $Excel = Win32::OLE->GetActiveObject('Excel.Application');
    >
    > $Book = $Excel->Workbooks->Open('C:\Documents and
    > Settings\pvernes\Desktop\CDS CORRELATOIN
    > PROJECT\Ford_equity_cds_data2.xls'); # open Excel file
    >
    > $Sheet = $Book->Worksheets(1); # select worksheet
    > number 1
    > $array = $Sheet->Range('AA6:AA508')->{value}; # get the contents
    >
    > $Book->Close;
    >
    # This loop does not print anything because the above code
    # does not put anything in @array.
    > foreach $array (@array) {
    > print $array;
    >
    > }
    >
    __END__

    Tom Wyant
    harryfmudd [AT] comcast [DOT] net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139