Execute a VBA Module from VB.Net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

From VB.Net, I want to open an Access database and run VBA module that
resides in the Access database. .Net gives me the error message that Access
can't find the VBA Module.

'StartCode

Dim appAccess as Access.Application
Dim strProc as String = "RunTest.myProc"

appAccess = CreateObject (Access.Application)
appAccess.OpenCurrentDatabase("C:\Documents and Settings\My
Documents\DB.mdb", False)
appAccess.Visible = True

'This is the problem statement:
AppAccess.Run(strProc)
'.Net gives me the error message: "Microsoft Access can't find the procedure
'RunTest.myProc.'." - For some reason there is an extra "." after myProc
which I don't know why its there

appAccess.Quit
appAccess = Nothing

'End Code

Thank you for your help
Mark
 
Try eliminating the parentheses around strProc in your call:

appAccess.Run strProc
 
Back
Top