in reply to Re^4: save read-only Excel
in thread save read-only Excel
use strict; use warnings; #use Storable; #use Cwd; use Win32::OLE; #use Win32::OLE qw(in with); #my $file = cwd.'\\'."myexcel.xlsm"; my $file = 'X:\Data\Perl\1131763\example.xls'; my $Excel = Win32::OLE->new("Excel.Application"); $Excel->{Visible} = 1; my $workbook = $Excel->Workbooks->Open($file); die "Failed to define Excel workbook" unless (defined $workbook); system("attrib -r $file"); $Excel->{DisplayAlerts} = 0; $workbook->Save;
My code is indented. The crucial lines are 13 & 14, but let's consider the rest (someone else may have a similar problem, so even if it's no use to you, it may be useful). Note that I have used code tags. It's much easier for everyone. Also, you have changed your original post without identifying what has changed. Changes are fine, but please mark them as such, otherwise people new to the thread may not understand replies made before the changes.
Regards,
John Davies
|
|---|