Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open Excel from Access

Status
Not open for further replies.

OahuBoy

MIS
Jun 24, 2004
3
US
This sounds like something very simple to do but I just can't figure it out. I have a function in Excel that builds queries and dumps the records into a single table, which it exports to an Excel template. All of this workis great but the one thing I can't figure out is how to have the workbook automatically open after the data is exported. I'm using the TransferSpreadSheet method. Does anyone know a way to do this?
 
code created by access wizard to open excel

On Error GoTo Err_Command4_Click

Dim oApp As Object

Set oApp = CreateObject("Excel.Application")
oApp.Visible = True
'Only XL 97 supports UserControl Property
On Error Resume Next
oApp.UserControl = True

Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
 
Maybe I should've been more clear. I have an existing Excel template that I'm using. I'm not looking to create a new workbook. I want the existing SS to open after the data is exported. Any help would be appreciated. Thanks.
 
I suggest you look at the output to method it has an autostart switch. Has decent description in access help. Good luck
 
this will open excel and the document specified in strDoc.

Private Sub Command7_Click()
Dim strDoc As String

strDoc = "C:\Book1.xls"

Call Shell("excel.exe " & strDoc, vbNormalFocus)

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top