Win::OLE excel function run twice

From: Jason Chen (jason4chen_at_yahoo.com)
Date: 10/30/03


Date: 30 Oct 2003 10:46:24 -0800

I have an excel macro in file c:\temp\test1.xls as this:

   Public Function test1(str As String)
      Debug.Print "the string is: " & str
   End Function

I run the macro through perl like this:

   use Win32::OLE;
   my $Excel = Win32::OLE->GetActiveObject('Excel.Application');
   my $Book = $Excel->Workbooks->Open("C:\\temp\\test1.xls");
   $Excel->Run('Test1("kabc")');

Here is Result:

   here is kabc
   here is kabc

The problem is the test1 function is run TWICE!!!

I am using Windows 2000 and ActivateState Perl 5.6.

Help!