On May 6, 2013, at 6:42 AM, Ganesh Babu N wrote:

> 
> Dear All,
> 
> I am having an XLSX file in server and my OS in Win7. The first open 
> statement is working fine in which we have give the actual file name.
> 
> 2nd open function is not working where we have given the file name as 
> variable. 
> 
> Please help in resolving this error. 
> 
> 
> use Win32::OLE;
> use Win32::OLE qw(in with);
> use Win32::OLE::Variant;
> use Win32::OLE::Const 'Microsoft Excel';
> $emfile="02896787";
> $Excel = Win32::OLE->GetActiveObject('Excel.Application') ||
>        Win32::OLE->new('Excel.Application');
> $Excel->{'Visible'} = 0;        #0 is hidden, 1 is visible
> $Excel->{DisplayAlerts}=0;    #0 is hide alerts
> my $mBook = $Excel->Workbooks->Open
>              ('\\\\pchns2003z\SPECIALIZED_SERVICES_I\AnI\Embase\Pull 
> files_IRNPD\inventory\02896787.xlsx'); # open Excel file
> 
> my $meBook = $Excel->Workbooks->Open
>              ("\\\\pchns2003z\\SPECIALIZED_SERVICES_I\\AnI\\Embase\\Pull 
> files_IRNPD\\inventory\\$emfile.xlsx"); # open Excel file
>              
> $Sheet2 = $mBook->Worksheets(1);
> $Sheet3 = $meBook->Worksheets(1);

I am not using Windows, but I suggest you try using a single forward slash as a 
path delimiter for both single and double quotes. I also note that your both of 
your strings start with '\\\\'. You might try building up the path in a single 
string variable and use that as the argument to Open, after printing out what 
the variable actually contains to verify your string is correct.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to