Excel from Access form

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

Guest

How do I dispaly a specific excel eorksheet in an excel workbook from an
access form. I have been able to display the specific workbook using the
SHELL comand but can't figure out how to display a specific woorksheet in the
workbook.
 
This will import to a specific table from a specific worksheet:

http://www.mvps.org/access/general/gen0008.htm

Here's a way using automation and early binding (you'll need to set a
reference to Excel):

Sub SampleExcelCode()
On Error GoTo Error_Handler

Dim appXL As Excel.Application
Dim wkb As Excel.Workbook
Dim wks As Excel.Worksheet

Set appXL = New Excel.Application
Set wkb = appXL.Workbooks.Open("C:\FolderName\ExcelFile.xls")
Set wks = wkb.Worksheets(1) ' This opens the first worksheet
appXL.Visible = True
' ... Do something
Exit_Here:
wkb.Close xlDoNotSaveChanges
Set wkb = Nothing
Set appXL = Nothing
rst.Close
Set rst = Nothing
Set db = Nothing
Exit Sub

Error_Handler:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Here

End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Darejamr said:
How do I dispaly a specific excel eorksheet in an excel workbook from
an access form. I have been able to display the specific workbook
using the SHELL comand but can't figure out how to display a specific
woorksheet in the workbook.


Application.FollowHyperlink "file://f:\excelfiles\test.xls", "Worksheet2!A1"

Acki
 
you have to import excel worksheet to access so that you able to view in
access form.
 
Actually, you can link an Excel Spreadsheet, exactly like you would an
Access table. The biggest drawbask to this is the fact that only one person
can work on a spreadsheet at a time, similar to locking an entire table in
Access.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

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