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

Open an existing Excel spreadsheet with a command button

Status
Not open for further replies.

Clarinet

Technical User
Mar 21, 2005
20
US
This is probably the easiest question of the day, but I cannot fine a way to open an existing Excel spreadsheet with the click of a command button.

Any help would be greatly appreciated!
 
Use the wizard to create the command button. One of the options is Application, which includes Excel.
 
Hello Remou,

Thank you for reminding me of the wizard for creating a command button.

I added the line in red to the wizard's code to open the specific spreadsheet that I wanted to view/print.

Code:
Dim oApp As Object

Set oApp = CreateObject("Excel.Application")
[COLOR=red]oApp.Workbooks.Open FileName[/color]
oApp.Visible = True
oApp.UserControl = True
 
Sorry, I misread your post. You can also use FollowHyperlink to open a file with its registered application:

FollowHyperlink Filename
 
Yes! FollowHyperlink is exactly what I needed - a simple way to open an existing spreadsheet. (Don't even need CreateObject).

Thank you Remou.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top