Hi Leo, Yes, it turns out the security setting is the issue. On machines where this didn't work, the security settings were different than on the machines where it did work. Thank you very much for your help with this puzzling issue. It is very much appreciated.
For any other users who may find this thread on Google, it was necessary to modify the Access security settings to get automation to run. To do that in Access 2007: 1. Open Access. 2. Click the "Office button" (the circle in the extreme upper right). 3. Select the "Access Options..." button. 4. On the "Access Options" dialog, click "Trust Center". 5. Click "Trust Center Settings...". 6. On the "Trust Center" dialog, click "Macro Settings". 7. Select "Enable all macros" (last option). Best regards, John On Wed, Jun 29, 2011 at 11:06 AM, Leo Susanto <leosusa...@gmail.com> wrote: > Try this: > http://stackoverflow.com/questions/837754/call-routine-in-access-module-from-net > > On Wed, Jun 29, 2011 at 10:19 AM, John Harrington <bearti...@gmail.com> > wrote: > > Hi Leo, > > Thanks for this. > > I tried this script on one of the machines that wasn't working yesterday > and > > received only this error: > > Last OLE32 error: Win32::OLE(0.1709) error 0x800a9d9f in > > METHOD/PROPERTYGET "Run" > > Any suggestions? > > So far I've tried automation on four separate machines: > > All with Access 2007 12.0.6535.5005 SP2 MSO 12.0.6554.5001 > > OS bits Perl version Works? > > XP 32 5.10.1 yes > > XP 32 5.12.4 no > > W7 64 5.12.4 yes > > W7? 64? 5.10.1 no > > I believe OS, bits, Perl version, and Access version can be ruled out as > the > > explanation. > > Thank you again, > > John > > > > On Tue, Jun 28, 2011 at 5:35 PM, Leo Susanto <leosusa...@gmail.com> > wrote: > >> > >> 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 <bearti...@gmail.com> > >> 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 > >> > Perl-Win32-Users@listserv.ActiveState.com > >> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > >> > > >> > > > > > >
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs