Professional Web Applications Themes

Writing VB macro script in xls - PERL Modules

Hi Which module should I use if I wish to process data in a xls file using a macro (which also I need to write) to generate graphs for the data already present in the xls file?...

  1. #1

    Default Writing VB macro script in xls

    Hi

    Which module should I use if I wish to process data in a xls file
    using a macro (which also I need to write) to generate graphs for the
    data already present in the xls file?

    Mick Guest

  2. #2

    Default Re: Writing VB macro script in xls

    In article
    <googlegroups.com>,
    Mick <com> wrote:
     

    There are (to my knowledge) no Perl modules that will allow you to do
    this. On Windows, you can use Win32::OLE to control the Excel
    application to do what you want (I have not used it.)

    --
    Jim Gibson

    Posted Via Usenet.com Premium Usenet Newsgroup Services
    ----------------------------------------------------------
    http://www.usenet.com
    Jim Guest

  3. #3

    Default Re: Writing VB macro script in xls

    Mick <com> wrote in message
    googlegroups.com 

    Maybe this one will put you on your way:

    #=========================
    use strict;
    use Win32::OLE;
    use Win32::OLE::Const 'Microsoft Excel';

    print "Opening Excel...\n";
    my $Excel = Win32::OLE->new("Excel.Application");
    $Excel->{Visible} = 1;

    my $Book = $Excel->Workbooks->Add;
    my $Sheet = $Book->Worksheets(1);
    my $Range = $Sheet->Range("A2:C7");
    print "Creating data...\n";
    $Range->{Value} =
    [['Delivered', 'En route', 'To be shipped'],
    [504, 102, 86],
    [670, 150, 174],
    [891, 261, 201],
    [1274, 471, 321],
    [1563, 536, 241]];

    my $Chart = $Excel->Charts->Add;
    print "Creating chart...\n";
    $Chart->{ChartType} = xlAreaStacked;
    $Chart->SetSourceData({Source => $Range, PlotBy => xlColumns});
    $Chart->{HasTitle} = 1;
    $Chart->ChartTitle->{Text} = "Items delivered, en route and to be shipped";

    print "Saving...\n";
    $Book->SaveAs({
    FileName => "c:\\my doents\\perl\\excel chart\\Excel Chart.xls" ,
    FileFormat => xlWorkbookNormal ,
    Password => "",
    WriteResPassword => "" ,
    ReadOnlyRecommended => 0 ,
    CreateBackup => 0 }) ;

    print "Closing...\n";
    $Excel->ActiveWorkbook->Close(0);

    print "Quiting...\n";
    $Excel->Quit();
    #=========================


    Dirk Guest

Similar Threads

  1. Writing single client script block for mutiple controls
    By Jason Barnett in forum ASP.NET Building Controls
    Replies: 6
    Last Post: June 17th, 01:36 AM
  2. I'm a bit RUSTY, need help writing a script for a global timer
    By eDubs webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 4
    Last Post: August 26th, 06:15 PM
  3. Script / action / macro / technique to resize, rotate CCW and Save jpg photos
    By Peter Sale in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 1
    Last Post: June 28th, 06:16 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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