Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 22nd, 2004, 04:09 AM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Opening Excel from Access

Hello All

I'm trying to open an existing Excel file from a button on an Access form and then pass control over to the Excel file to make some changes. Is it possible to do this from Access?

Any help is much appreciated.

Sach
 
Old June 22nd, 2004, 04:29 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to qazi_nomi
Default

If u want to get some data from Excel file into your database of Access then you can simply import the excel file in your data base

Love 4 all
 
Old June 22nd, 2004, 04:32 AM
Authorized User
 
Join Date: Oct 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by qazi_nomi
 If u want to get some data from Excel file into your database of Access then you can simply import the excel file in your data base

Love 4 all
I just want to be able to open a specific Excel file from my Access form.

Thanks for your help though.
 
Old June 22nd, 2004, 10:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,093
Thanks: 1
Thanked 12 Times in 11 Posts
Default

Hi Sach,

In a module:

Sub OpenXLWorkBook(Path As String)

    ' SET REFERENCE: Microsoft Excel x.0 Object Library

    Dim xlApp As Excel.Application

    If Dir(Path) = "" Then
        MsgBox Path & " isn't a valid path!"
        Exit Sub
    Else
        Set xlApp = CreateObject("Excel.Application")
        xlApp.Visible = True
        xlApp.Workbooks.Open Path
    End If

End Sub

Behind a Command Button:

Private Sub Command0_Click()
    OpenXLWorkBook "C:\Test.xls"
End Sub

Be sure and set a reference to the version of the Excel object library on your system.

Bob








Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in opening excel file in MS Excel 2000 kallol Visual C++ 0 November 16th, 2007 05:48 AM
Opening Excel bomber Access VBA 4 November 28th, 2006 11:33 PM
Opening Excel file p2pMember ASP.NET 1.0 and 1.1 Professional 1 January 21st, 2006 01:54 PM
Run ACCESS Aplication Without Opening ACCESS kamal1667 Access 3 January 2nd, 2006 12:13 PM
Opening Excel and Excel files dinosaur_uk VB.NET 2002/2003 Basics 3 September 17th, 2004 03:22 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.