Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Greetings! I have a script that mucks around in Excel, which I've been using since Office 2000. Suddenly and tragically, I am having issues with Excel 2013 users. I need to make the workbook visible, otherwise when I save the Excel file, the workbook will be hidden when the user tries to open it. I have used the code below successfully for years to accomplish this. I have marked the offending line below in the code. When this is used with Excel 2013 on Win7 x64, I get the following error:

Win32::OLE(0.1712) error 0x8002000b: "Invalid index" in METHOD/PROPERTYGET "Windows" at blah.pl line 91. Can't use an undefined value as a HASH reference at blah.pl line 91.

Has anyone else run into this, or have any suggestions?

use strict; use Win32::OLE qw(with); use Win32::OLE::Const 'Microsoft Excel'; sub open_sheet { my $file = shift; my $workbook = Win32::OLE->GetObject( "$file" ) || die "Could not locate $file.\n"; my $excelApp = $workbook->{Application}; $excelApp->{Visible} = 1; # ****this next line no longer works in Excel 2013**** $excelApp->Windows( $workbook->{Name} )->{Visible} = 1; # ^^^^bad! .... }

Thanks!


In reply to Making workbook visible with Excel 2013 by chinman

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 surveying the Monastery: (5)
As of 2024-04-20 00:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found