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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to put command button to open an excel file on an access form

Status
Not open for further replies.

Iendyar

Technical User
May 10, 2004
17
US
Hi all. I have been trying to figure out how to put a command button that will open an excel file on a form in access. I have had no luck. Any help would be greatly appreciated.
Thanks in advance
 
I would try first searching the Access Forms forum for a solution. If you can't find the answer, then try posting in that forum.

[blue]"Well, once again my friend, we find that science is a two headed beast. One head is nice, it gives us aspirin and other modern conveniences,...but the other head of science is BAD! Oh, beware the other head of science, Arthur; it bites!!" - The Tick[/blue]
 
Tendyar,did you get a response about excel command buttons? I have some on my main form and they open an excelss. Don't have this computer, but will be glad to go get them if you still need them.
 
Take a look at the Hyperlink property of the command button.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Here is something...

Code:
Private Sub RunExcel_Click()

    Dim stAppName As String, stFile As String

    stFile = "YourDrive:\YourDirectory\YourExcel.xls"
    stAppName = "YourDrive:\DirectoryToExcel\EXCEL.EXE"
    
    Call Shell(stAppName & " " & stFile, 1)

Obviously replace...
YourDrive - with appropriate drive, i.e. C:
YourDirectory - location of your Excel file
YourExcel - Name of your Excel file
DirectoryToExcel - program directory for locaiton of Excel program, probably Program Files\Microsoft Office\Office

Use this code to run for the "On click" event for your command button.

Richard
 
Thank you all so much. Your help has been invaluable!
Iendyar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top