Using Excel without Macros

H

Henning

Hello!
I have "inherited" the following code:

use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;
$Excel = Win32::OLE->new('Excel.Application', 'Quit'); # get a new
excel
$Book1 = $Excel->Workbooks->Open("$abs_file_name"); # open Excel
file

When opening Excel (line 4) excel tries to start any macros associated
with the file.
Is there a way to avoid this (meaning: force excel to open the file
with disabled macros)?
And how to do so?

Thanks a lot
Henning
 
J

johannes keßler

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello!
I have "inherited" the following code:

use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;
$Excel = Win32::OLE->new('Excel.Application', 'Quit'); # get a new
excel
$Book1 = $Excel->Workbooks->Open("$abs_file_name"); # open Excel
file

When opening Excel (line 4) excel tries to start any macros associated
with the file.
Is there a way to avoid this (meaning: force excel to open the file
with disabled macros)?
And how to do so?

Thanks a lot
Henning
Hello,

first I think this is a user level problem, which can't be solved at programming
level.
Since the user can set if he want's to run those macros or not.

Then I fond someting in addtion to the standart way to remove macros:

http://www.eng-tips.com/faqs.cfm?fid=48

regards,
johannes keßler
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkp2yMoACgkQE++2Zdc7EtdztwCff0LlN4DX+07+sQj5vz6Bvxxm
TyoAnRbZ164f+faz/JzRAfyCvlH3xOJ7
=zaSu
-----END PGP SIGNATURE-----
 
B

Brian Helterline

Henning said:
Hello!
I have "inherited" the following code:

use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;
$Excel = Win32::OLE->new('Excel.Application', 'Quit'); # get a new
excel
$Book1 = $Excel->Workbooks->Open("$abs_file_name"); # open Excel
file

When opening Excel (line 4) excel tries to start any macros associated
with the file.
Is there a way to avoid this (meaning: force excel to open the file
with disabled macros)?
And how to do so?

Thanks a lot
Henning

for Excel 2007, this is controlled with the AutomationSecurity property
of the application. The help gives an example of how to do exactly what
you are asking (in VB, not perl)
 
J

Justin C

Hello!
I have "inherited" the following code:

use Win32::OLE::Const 'Microsoft Excel';
$Win32::OLE::Warn = 3;
$Excel = Win32::OLE->new('Excel.Application', 'Quit'); # get a new
excel
$Book1 = $Excel->Workbooks->Open("$abs_file_name"); # open Excel
file

When opening Excel (line 4) excel tries to start any macros associated
with the file.
Is there a way to avoid this (meaning: force excel to open the file
with disabled macros)?
And how to do so?

Use Spreadsheet::ReadExcel (or Spreadsheet::WriteExcel) instead? It
depends what you are wanting to do. Excel starting and running macros
automatically is something Excel does, I believe there is somewhere in
Excel to turn this off. If you need to actually start Excel from Perl I
don't think it's possible to do what you want, that's Excel specific,
not Perl.

Justin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top