Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Using Win32::OLE and Excel - Tips and Tricks

by cacharbe (Curate)
on Jul 16, 2003 at 13:10 UTC ( #274802=note: print w/ replies, xml ) Need Help??


in reply to Re: Using Win32::OLE and Excel - Tips and Tricks
in thread Using Win32::OLE and Excel - Tips and Tricks

What have you tried? Did it work? Did you take my advice up top and research the object model? Based on the Chart / Graph info I provided and a little reading, you should be able to figure this out. Even Google can be your friend. I read the second link (which gave me some ideas about ADSI and perl, btw) and found it interesting and helpful and David Wagner bubbled some of Jan DuBois' code up to top a while back here. Give these a read and give it a try.

Let us know how it goes.

C-.

---
Flex the Geek


Comment on Re: Re: Using Win32::OLE and Excel - Tips and Tricks
Re: Re: Re: Using Win32::OLE and Excel - Tips and Tricks
by Anonymous Monk on Jul 18, 2003 at 09:41 UTC
    Thanks :) nice articles and it's very helpful.
Re^3: Using Win32::OLE and Excel - Tips and Tricks
by nisha (Sexton) on Dec 20, 2005 at 08:36 UTC
    Hello Monk, Just read your documentation on Excel, and found it extremely useful. I have a problem and looking for some help regarding this. This is my code below
    #!/usr/bin/perl use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $MacroName = "LargeFileImport"; #Running a macro $excelfile = "c:\\SndExMail\\test.xls"; my $Book = $Excel->Workbooks->Open($excelfile); my $Sheet = $Book->Worksheets("Sheet1"); $Sheet->Activate(); $Excel->Run($MacroName);
    I am running a macro, which will generate another excel file with certain values spanning across multiple sheets. Now after i execute the above code, a pop is displayed asking me to save sheet1 (this is generated after the macro is run). I can set displayalerts to 0 but At the same time i want to save the excel file generated by the macro with some name so that i ccan open it for manipulations later. Please let me know how to go about doing this.

      In replying to a (nearly) 4-yr old node, your question is in danger of flying beneath everyone's radar. Better to post under Seekers of Perl Wisdom. To get an idea of how this site works, I recommend looking at the "Welcome to the Monastery" section of the Tutorials page.

      Super Search is also quite helpful. Creative use would turn up nodes like Index of Spreadsheet FAQs.

      ActiveState has an article that shows How to convert a VBA macro to Perl. An offsite reference that may help too is The Spreadsheet Page with its extensive Excel FAQs.

      You may also have on your machine something called "OLE Browser" or "Type Library Browser" if you installed Win32-OLE-0.1403 or upgraded from that to a later version. You might find it in C:\Perl\html\OLE-Browser or C:\Perl\html\lib\site\Win32\OLE depending on your install.

      Something else I've found to be very handy indeed is West Wind Technology's GetConstants utility, which allows you to look at all those cryptic constants MS Office uses. Note that they do shuffle the links around occasionally, so it may be necessary to do some searching.

      Ok, more to the point... The command you are looking for is (in VBA):

      Dim Book as Workbook Book.Save

      or, perhaps,

      Book.SaveAs(FileName, FileFormat, Password, WriteResPassword, ReadOnly +Recommended, CreateBackup, AccessMode, ConflictResolution, AddToMru, +TextCodepage, TextVisualLayout, Local)

      You should now have all the information necessary to tweak this as needed. :-)

      Update: You might also wish to investigate the GetSaveAsFilename function...

      planetscape

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://274802]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2014-09-19 22:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls