Open Excel

  • Thread starter Thread starter JB
  • Start date Start date
J

JB

I'm trying to run a call to open Microsoft Excel from a
form via a push button, that will open a specific
worksheet located on a pool drive. Any help is
appreciated.
 
Hi JB,

try the following in the click event for the button:

Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.workbooks.Open "c:\book1.xls"
xlApp.Visible = True

replace the path with your own.

hth

chas
 
One way I found to do this is by creating a macro and tie
a command button or a toggle button, I wasn't sure which
type of push button you were talking about, but either way
will work.

To create the macro do the following:
Click on the macro tab and choose new
Action: choose OutputTo
-down at the bottom of the screen in the Action Arguments-
Object Type: choose from the List what you are wanting to
export to excel.
Object Name: choose the name of the object type
Output Format: choose Microsoft Excel
Output File: type where you want the file to go. ex: C:\my
documents\test.xls
Auto Start: If you want excel to start when exporting is
complete choose Yes.

The next step is to tie it to a button:
Command Button
In Catergories click Micellaneous
On the Action side click Run Macros
click Next
Click on the Macro you created
Next
Choose if you want a button or a text
Next
Name the button
Finish.

Toggle Button
Open properties
Click on the event tab
Go to the On Click and from the dropdown button click the
macro.

Your done.

Another reason I like macros is that you can send them to
your desktop by right clicking on the macro and create
shortcut. This way when you need the file ran you can
double click on it and it will run it.

I hope this helps.

Terri
 
Back
Top