new to access question about refrences

  • Thread starter Thread starter cjbarron5
  • Start date Start date
C

cjbarron5

can you make access refer to an excel sheet and if so how

thanks chris
 
works great as long as the file is open..........did I do something wrong?
 
Hi Chris,

What you need to do is as below coding

-- Define the object

Dim oExl As Object
Dim oSheet As Object

-- Open thte Excel.Application in the form
Set oExl = CreateObject("Excel.Application")
oExl.Workbooks.Open (FileName)
Set oSheet = oExl.Sheets(1)

-- Then you can read the spreadsheet
Myfield in Access = oSheet.Cells(1, 2)
etc

-- Remember to close the EXCEL after you.
oExl.Quit
Set oExl = Nothing

-- It is very simple and you should able to find some examples in the
Internet

Wish I can help.
Raymond
 

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

Back
Top