Run Access Subroutine (or Function) from Excel

R

Ross

How can I run the Access Sub called "ImportExcel" From Excel. My Code
properly opens the Access database but bombs in finding the subroutine called
"Public Sub ImportExcel". Syntax?

'*************************
Sub OpenAccess_FromExcel()
'*************************
Dim A As Object
Set A = CreateObject("Access.Application")
A.Visible = True
A.OpenCurrentDatabase ("C:\Documents and Settings\rcrill\My
Documents\Ref_Code\ImportExcel.mdb")
A.Run "ImportExcel"<---------------------This Fails
A.Quit
End Sub

Many Thanks

Ross
 
J

Joel

I don't know if this is the only problem but make sure the reference to
Access is selected in the Excel VBA menu

Tools - References - Microssoft Access 11.0 Object Library
 
R

Ross

Joel,

That was it. Thank you. The Reference Library never seems to be intuitive
with me.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top