View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default openning Access via Excel

Check to see if you have set up a reference to Access.

In VBA, select Tools/References and ensure Access is checked (probably will
be listed as Microsoft Access).



"Huaqin" wrote:

hi all,

can you please correct my codes or any other setting for my Excel program?
I got this error "Complie error, User-defined type not defined", codes below
in Modules:

Public Sub iConn()
Set oaccess = New Access.Application
oaccess.OpenCurrentDatabase (Sheets("Main").Range("A1").Value)
Set db = oaccess.CurrentDb()
End Sub