Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

The first thing that I personally don't like about the sample code you provided is the attempt to check to see if an instance of Excel is running and to take control of it if there is one. Personally, I prefer my script to open a new instance of Excel so that the script does not interfere with the person/script that is using the other instance. Just a personal preference, but wanted to share my thoughts on that topic.

The sample code's method for closing Excel works fine for Excel 2003 and I believe Excel 2007 too. However, Excel 2010 introduces a few new wrinkles. First, you can specify what version to save the file as (Excel 2007 and older format, Excel 2010 format, etc.). Also, if the format and file extension don't match, Excel likes to prompt the user about what to do. If you have Excel 2010, just manually try saving a new file as different formats and extensions to see what I'm talking about. Also, you can record a macros to see what the VB code looks like to handle some of these "save as" scenarios and convert that to Perl for your script. Just wanted to mention this information in case the OP (or any future reader) is using Excel 2010 (or newer) and finds the information useful.

Note that the visible=1 is great for debugging, but shouldn't be used in a production environment once your script is complete.

Ummm...again I disagree and think that this is a matter of personal preference. Although I typical use the visibility setting as you described, I have a coworker who prefers to leave visible set to 1 so that he can visually watch the script as a method to verify that the script really is running and doing what it is supposed to do. Despite disagreeing with him, I personally am not going to tell someone that they shouldn't be doing that. Basically, just applying the concept of TIMTOWTDI.


In reply to Re^3: Perl r/w Excel with OLE by dasgar
in thread Perl r/w Excel with OLE by Henry07

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-24 14:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found