473,320 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Calling macro from another workbook using perl

12
Hi,

I am dealing with running macros through perl.
i have following script to do the same which is working fine.Now what i have to do is to make one .xlsm (macro-enabled file)which will contain all the needed macros.
and i need to call that macros from another .xlsx file.
I am trying to give path in that RUN() rather than macro name but it is not working.
Can anybody tell me,how to do this?


Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2. use strict;
  3. use Win32::OLE qw(in with);
  4. use Win32::OLE::Const;
  5. use Win32::OLE::Const 'Microsoft Excel';
  6. $Win32::OLE::Warn = 3;
  7.  
  8.  
  9. my $filename = 'F:\perl\report.xlsx';
  10.  
  11. my $Excel = Win32::OLE->GetActiveObject('Excel.Application') 
  12. || Win32::OLE->new('Excel.Application', 'Quit'); 
  13.  
  14. my $Book = $Excel->Workbooks->Open( $filename );
  15.  
  16. $Excel->Run("Deletebrows"); # This is macro name
  17. $Excel->Run("FillEmptyCellWithZero"); # This is macroname
  18. $Book->Close;
  19.  
  20.  
  21.  
Apr 14 '12 #1
0 1810

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: rahatekarabhijeet | last post by:
I want to create excel sheet using perl, i had installed all the necessary modules from CPAN. The perl program i taken from CPAN itself it is given below, #!/usr/bin/perl -w use warnings; use...
0
by: Probleminfinity | last post by:
Hi, I have been trying to Copy a worksheet into another workbook and rename it using macro. But while running it Gives me an error: Run-time error '40036': Application-defined or object-defined...
4
by: Npreeti | last post by:
HI , I want to copy a file from one machine to another machine using perl. Also i want to know whether i can past arguments to perl program?
6
by: sainiamit25 | last post by:
Hi, I want to parse a file and from some of the attributes of this file, i want to create another file using perl. Can anybody suggest me a way out? It would be great if i dont have to use any...
2
by: danny2000 | last post by:
Hi all. Please excuse my ignorance here, but is it possible and / or efficient to do things such as insert worksheets, make charts, pivot tables, filter data in an excel workbook using Perl? ...
1
by: jawas | last post by:
Can any body help to write the general Perl script to transfer file from one window XP machine to another window XP machine and then change the file name and send some command for e.g config, 9,9 to...
3
by: flow3rgirlz | last post by:
Hi all, I'm really new to Perl. I'm not sure where to post my topic as it between Perl and Visio. Anyway, I want to run a Visio macro automatically using Perl Script. $vis->Run($macro_to_run);...
4
by: hiitzsdg | last post by:
Hi All, I am completely new to VBA and I am trying to develop a macro in a workbook (Backup.xls). The main functionality of the macro is: 1. It would open another workbook (Source.xls). 2....
0
by: Eddie Rivera | last post by:
How can I run a macro automatically in another workbook when that workbook is being updated? I tried the "call macro" routine but it isn't working for me. Any and all help is very much appreciated!
0
by: Michael mealin | last post by:
Hi guys. I am trying to fuly automate a cut and paste operation. Basically the data is dragged off the net, formatted using a macro in word then copied from word and pasted into Excel. From there...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.