Creating a button in a form

ginap

Registered User.
Local time
Today, 16:39
Joined
Jun 16, 2009
Messages
38
Hi,

How do I create a button in my form that will automatically open an excel spreadsheet located on our server? I know how to create buttons, but getting it to do something other than what's in the control wizard is what I am confused about.

Thank you!
Gina
 
Basically you want to add this code to your button.

Code:
    Dim objApp As Object
    Dim objBook As Object
 
    'create an instance of Excel
    Set objApp = CreateObject("Excel.Application")
 
    'make Excel visible
    objApp.Application.Visible = True
 
    'open the require spreadsheet
    Set objBook = objApp.Workbooks.Open("C:\Temp\Sample.xls")

Take a look at the code for the following post for a discussion of some other excel related issues.

http://www.access-programmers.co.uk/forums/showthread.php?t=128796
 
Beautiful. Thank you!!
 
If you are just opening a spreadsheet and not planning on interacting with it, you can also use this one liner:

Code:
FollowHyperlink "C:\Temp\Sample.xls"
 

Users who are viewing this thread

Back
Top Bottom