Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

merging cells in excel

by chuckdawit (Initiate)
on Apr 21, 2005 at 01:27 UTC ( [id://449828]=perlquestion: print w/replies, xml ) Need Help??

chuckdawit has asked for the wisdom of the Perl Monks concerning the following question:

I need help with merging cells in MS Excel. I am using this to do it.
$excel->Workbooks(1)->Worksheets('Sheet1')->Range($a,$b)->{MergeCells} + = 1; whare $a = Cells(1,2); and $b = Cells(1,4);
now this works fine, but every time a merge occurs in excel a pop up box appears warning me that my data will be merged. I don't want this box appearing every time there is a merge. Because, I might be merging cells in a loop and might be doing it 20-30 times in my perl script. I don't want 30 warning boxes appearing giving me that warning. Does anyone know how to fix this? please respond to cpareto@force10networks.com

Thanks, Chuck

Edit by tye: Add formatting tags

Replies are listed 'Best First'.
Re: merging cells in excel
by bmann (Priest) on Apr 21, 2005 at 05:01 UTC
    Before merging cells, use $excel->{DisplayAlerts} = 0; to turn off alerts.
      thanks, whare did you get this information?
        You won't find it in the Win32::OLE docs. I first learned it a long time ago writing Excel macros with VBA. The Excel help files and the object browser are your friends.

        If you are using Excel automation regularly, you'll want to be familiar with Excel's object model. You can find help and diagrams in the help files, but the Programming help files are not installed by default.

        Once you are familiar with the object model, use the Object Browser for quick lookups. If you don't already know where to find the object browser, open the VBA code window (I use Alt+F11) and then open the Object Browser using the View menu or just hit F2.

        Another great place to learn is cacharbe's Using Win32::OLE and Excel - Tips and Tricks.

        Good luck!

        Update: And remember the macro recorder to help with syntax.

Re: merging cells in excel
by Limbic~Region (Chancellor) on Apr 21, 2005 at 12:09 UTC
    Chuck,
    It appears bmann knew what you were talking about and offered an applicable reply, but I for one was lost. You see, this doesn't look like Spreadsheet::WriteExcel syntax (the module I use). My point being, if you are going to introduce your code, you might also want to mention what module/library you are using.

    Cheers - L~R

      Ya, sorry about that. I'm only using OLE. Thanks. Chuck

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://449828]
Approved by moot
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 20:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found