Currently I am trying to execute a macro in Microsoft Access through Perl OLE
I am wondering how to properly make the call to run a macro. I have tried
1) $oDatabase -> DoCmd.RunMacro("Macro1");
2) $oDatabase -> DoCmd -> RunMacro("Macro1");
But they throw me "Can't call method "DoCmd" on an undefined value" or "useless use of concatentation"
Is this even possible to execute a DoCmd through Win::32 OLE? Any help would be greatly appreciated.
Here is a complete code. It tries to look for the current Microsoft Access that is opened.
use strict;
use warnings;
use Win32::OLE;
my $oAccess;
my $oDatabase;
my $filename = "C:\\Sample.accdb";
$oAccess = Win32::OLE->GetActiveObject('Access.Application');
$oDatabase = $oAccess->OpenCurrentDatabase($filename);
$oDatabase -> DoCmd.RunMacro("Macro1");