General discussion

Locked

Open Excel workbook & close from Access

By dennisbv ·
I am having trouble with a pocedure. I need to open a specific Excell file to refresh data that my Access program uses. I want to open the sheet (hidden if possible) and after the data is refreshed the sheet is then closed.

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Open Excel workbook & close from Access

by miket In reply to Open Excel workbook & clo ...

Here's some code to access Excel spreadsheets:

Dim App As Excel.Application
Dim Workbooks As Excel.Workbooks
Dim book As Excel.Worksheet


Set App = New Excel.Application

App.Workbooks.Open FileName:=txtSpreadsheetFileName

Set book = App.Worksheets.Item(1)

book.Range("A1").Select

--Your code--

App.Workbooks.Close

Set Workbooks = Nothing
Set App = Nothing


You could also import the spreadsheet into a temporary table then use that table to update your live database:

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "TableName", txtSpreadsheetName, True

Collapse -

Open Excel workbook & close from Access

by dennisbv In reply to Open Excel workbook & clo ...

Poster rated this answer

Collapse -

Open Excel workbook & close from Access

by dennisbv In reply to Open Excel workbook & clo ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums