Using win32::OLE to create excel file on a remote windows share

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • anandmadhu
    New Member
    • May 2012
    • 2

    Using win32::OLE to create excel file on a remote windows share

    I am using the following code to create an excel file on the share on the remote win2007 professional.

    Code:
    use Win32::OLE qw(in with);
    use Win32::OLE::Const;
    use Win32::OLE::Variant;
    use Data::Dumper;
    use Win32::NetResource
    
    my $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application','Quit');
    print $Excel->{Version};
    my $Book = $Excel->Workbooks->Add() or die $!;
    my $filename = "\\\\192.168.20.41\\SHARE\\Test1.xls";
    $Book->SaveAs($filename) or die $!; # Dies here
    However I am able to create a word file on the same machine. I am just not sure if I am missing anything specific to Excel implementation of OLE objects.

    Please help
    Last edited by anandmadhu; May 7 '12, 04:53 AM. Reason: typo
  • anandmadhu
    New Member
    • May 2012
    • 2

    #2
    Actually it worked. I was able to debug the issue better by using die Win32::OLE->LastError()

    Thanks.
    Last edited by anandmadhu; May 7 '12, 06:12 AM. Reason: typo

    Comment

    Working...