Execute Access 2003 Macros in SSIS Package
Hi
Does any one know how to execute Macros in SSIS Package.
I have an Access 2003 Macro which has to be executed in a SSIS package...
I need to pass some runtime parameter also .
How to go about it....
Thanks & Regards
Deepu M.I
November 17th, 2006 4:07pm
Deepu.MI wrote:Hi
Does any one know how to execute Macros in SSIS Package.
I have an Access 2003 Macro which has to be executed in a SSIS package...
I need to pass some runtime parameter also .
How to go about it....
Thanks & Regards
Deepu M.I
Free Windows Admin Tool Kit Click here and download it now
November 17th, 2006 4:11pm
Hi
Baiscally to execute an Access Macros in SSIS package we need to Download Microsoft.Office.Interop.Access DLL from Office XP PIAs.
Download site http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en
1) Extract the Microsoft.Office.Interop.Access DLL from Oxppia.exe
2) Drag and Drop Microsoft.Office.Interop.Access DLL to Global Assembley Directory(GAC) ie: C:\WINNT\assembly for Windows 2000 -- C:\WINDOWS\assembly for ( Win Xp and Win 2003)
3) Copy paste Microsoft.Office.Interop.Access to C:\WINNT\Microsoft.NET\Framework\v2.0.50727 for Windows 2000 -- C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 ( Win Xp and Win 2003)
4) Add DLL reference in the Script Task
5) Add the below Code
Imports Microsoft.Office.Interop.Access
Try
Dim objAccess As New Access.Application
objAccess.OpenCurrentDatabase("D:\TestMacro.mdb", False) ' Add the Access File Path
objAccess.DoCmd.RunMacro("Macro1") ' Replace Macro1 with the name of your macro
objAccess.CloseCurrentDatabase()
objAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
objAccess = Nothing
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString())
End Try
Dts.TaskResult = Dts.Results.Success
Note :
Change the Security Level for Access Macro... otherwise when ever the SSIS packageexecute it should popup a Security Warning Message... To avoid this ,,, follow the instruction
Open Access -- > Tools --> Macro --> Security
Click the Security and Changed to Low Level...
Thanks & Regards
Deepu M.I
November 27th, 2006 9:58am