Opening an Excel Spreadsheet from MS Access

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

Guest

I am trying to open an existing Excel Sheet from within an Access db. My
users insist on having Excel spreadsheets as opposed to Access reports so I
take a table and dump it into Excel using transferspreadsheet.

What I am trying to do now is after the user clicks a button in the Access
app, I want to display the spreadsheet I've just updated.

Here is the code as it stands now:

Dim oSheet As Object
Set oSheet = GetObject("C:\Documents and Settings\E09461\My Documents\Access
Db's\Development\MetricsDashboardReport.xlt")
Dim oApp As Object
Set oApp = oSheet.Parent
oApp.Visible = True
oApp.UserControl = True

This works after a fashion but... when I toggle to Excel, my workbook is
open but hidden, is there anything I can do to rectify this or am I on the
wrong path altogether?

Thanks,

m
 
I am trying to open an existing Excel Sheet from within an Access db. My
users insist on having Excel spreadsheets as opposed to Access reports so I
take a table and dump it into Excel using transferspreadsheet.

What I am trying to do now is after the user clicks a button in the Access
app, I want to display the spreadsheet I've just updated.

Here is the code as it stands now:

Dim oSheet As Object
Set oSheet = GetObject("C:\Documents and Settings\E09461\My Documents\Access
Db's\Development\MetricsDashboardReport.xlt")
Dim oApp As Object
Set oApp = oSheet.Parent
oApp.Visible = True
oApp.UserControl = True

This works after a fashion but... when I toggle to Excel, my workbook is
open but hidden, is there anything I can do to rectify this or am I on the
wrong path altogether?

Thanks,

m

Try it this way:

DoCmd.TransferSpreadsheet etc....
Application.FollowHyperlink ""C:\Documents and Settings\E09461\My
Documents\Access Db's\Development\MetricsDashboardReport.xlt")

Note: you have the Excel workbook extension as xlt not xlc, Is that
that you want?
 
Yes, the output is actually an Excel template that formats the data the way
the user wants it.
 
Back
Top