P
Pat
I am having a problem. I want to open 600 excel files and add the
work REV A to the first cell. I am using Win32::OLE. Here is the
code. Very simple.
For every file that opens, I get a box that asks if I want to
overwrite the file. How do I force the answer to the popup to be yes?
#!c:/perl/bin/perl -w
use Win32::OLE;
$workdir = "c:\\temp\\GLNWI";
open (GLN_WI, "$workdir\\gln_file.txt") || die "Can't open gln_file";
@gln_wi = <GLN_WI>;
close GLN_WI;
foreach $file_name (@gln_wi) {
chomp $file_name;
$file_name = $workdir . "\\" . $file_name;
print "file_name = $file_name\n";
$excel = new Win32::OLE ('Excel.Application', 'Quit');
$excel->{Visible} = 0;
$excel->Workbooks->Open("$file_name") or die ("Error: unable to
open document ", Win32::OLE->LastError());
$excel->Range("A1")->{Value} = "Rev A";
$excel->SaveAs('$file_name');
undef $excel;
}
work REV A to the first cell. I am using Win32::OLE. Here is the
code. Very simple.
For every file that opens, I get a box that asks if I want to
overwrite the file. How do I force the answer to the popup to be yes?
#!c:/perl/bin/perl -w
use Win32::OLE;
$workdir = "c:\\temp\\GLNWI";
open (GLN_WI, "$workdir\\gln_file.txt") || die "Can't open gln_file";
@gln_wi = <GLN_WI>;
close GLN_WI;
foreach $file_name (@gln_wi) {
chomp $file_name;
$file_name = $workdir . "\\" . $file_name;
print "file_name = $file_name\n";
$excel = new Win32::OLE ('Excel.Application', 'Quit');
$excel->{Visible} = 0;
$excel->Workbooks->Open("$file_name") or die ("Error: unable to
open document ", Win32::OLE->LastError());
$excel->Range("A1")->{Value} = "Rev A";
$excel->SaveAs('$file_name');
undef $excel;
}