On Wed, 9 May 2001 13:30:02 -0500, "Adam Frielink" <[EMAIL PROTECTED]>
wrote:

>Issues:  I can access the Application Object and the Report Object
>underneath it.  The OpenReport method executes properly (I am assuming) but
>returns the 'Retrying default method a C:\per\site\lib\Win32\OLE\Lite.pm
>line 156."  Defining the $CrystalReport variable is successful as my print
>statement displays the hash.  After that, I get an error stating that "Can't

No, it is not successful!  You are displaying the $Crystal value, *not*
the $CrystalReport value.  Please run your script with "perl -w" to get
better error messages from Win32::OLE!

>call method "FormulaFieldDefinitions" on an undefined value at test1.pl line
>26."
>
>Then my exit code executes normally...
>
>Since FormulaFieldDefinitions is a Collection Object, I know I need to use
>Enum.  But, I cannot even define a reference to that object, so, I can't
>Enum it.
>
>Does anyone have a simple pointer they could throw my way?
>
>
>***************
>use Win32::OLE;
>use Win32::OLE::Lite;

You should never need to "use" this module explicitly!

>use Win32::OLE::Const;
>use Win32::OLE::Enum;
>use Cwd;
>
>$current_dir = cwd;
>
>   $Class = "CrystalRuntime.Application";
>   $File = "$current_dir/SALES.RPT";
>
>   $Crystal = Win32::OLE->GetActiveObject( $Class );
>   if( ! $Crystal ) {
>      $Crystal = new Win32::OLE( $Class, \&QuitCrystal )
>         || die "Could not create an OLE '$Class' object";
>   }
>
>
>
>print "Before Attempt to open\n$File\n";
>
>   $Crystal->OpenReport( $File );
>   my $CrystalReport = $Crystal->Report;
>   print "CrystalReport: $Crystal Report\n\n";
                                  ^
The blank above is throwing you off.  You are printing the wrong variable!

>
>   my $CrystalReportFFD = $CrystalReport->FormulaFieldDefinitions();
>   print "Crystal Report FFD: $CrystalReportFFD\n\n";
>   my $CYear = $CrystalReportFFD->Value;
>
>   print "$CYear\n\n";
>
>sub QuitCrystal {
>   my $ComObject  = shift;
>   print "Quitting " . $ComObject . "\n";
>   $ComObject->Quit();
>}
>********************

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to