Thank, so Access 2007 is installed in all of the machine

Could you please run this and see if there is any error?

use strict;
use warnings;
use Win32::OLE;
my $oAccess;
eval {$oAccess = Win32::OLE->GetActiveObject("Access.Application")};
if ($@) {
        die "Access.Application is not installed\n";
}
unless (defined $oAccess) {
        unless ($oAccess = Win32::OLE->new("Access.Application", sub
{$_[0]->Quit;})) {
                die "Can not start Access.Application\n";
        }
}
$oAccess->OpenCurrentDatabase("C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb");
print "Last OLE32 error: ". Win32::OLE->LastError() if
(Win32::OLE->LastError());
$oAccess->Run("AutomationTest");
print "Last OLE32 error: ". Win32::OLE->LastError() if
(Win32::OLE->LastError());

On Tue, Jun 28, 2011 at 4:36 PM, John Harrington <[email protected]> wrote:
> I have a very simple script using Win32::OLE that works perfectly on my
> machine but not on other people's machines and I can't figure out why.
> The script is as follows:
>
> use strict;
> use warnings;
> use Win32::OLE;
> my $oAccess;
> $oAccess = Win32::OLE->new('Access.Application') or die "Unable to start
> Access";
> $oAccess->OpenCurrentDatabase("C:\\vpdb\\depot\\VProject\\Database\\xdb.accdb");
> $oAccess->Run("AutomationTest")
>
> When I run it on my machine, it successfully runs a Public Function called
> AutomationTest in my database.  This function writes two files to the cwd, a
> text file and a simple Excel spreadsheet.
> When I run this script on other people's machines, the script executes (same
> OS, same version of ActiveState Perl (5.10.1), same database, same
> permissions) but the files are not written, which suggests the automation is
> not working.  No errors are generated.  The script runs, but there are no
> files produced.
> Again, it works on my machine, not on theirs, with apparently the very same
> conditions.  I even tried sharing my Perl folder so another user could be
> assured he was running the same version of the module and Perl.
> I am at my wit's end.  Any help would be appreciated.
> Can you think of any reason such a simple application of the Win32::OLE
> module would work on one machine and not on another?
>
> Thanks,
> John
>
>
>
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to