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

Opening an Excel file from a macro

Status
Not open for further replies.

ScubaStevo

Programmer
May 4, 2002
132
AU
Hi

How can I open an excel file from a macro? Or even in VBA will be fine.

Thanks

Steve
 
see thread692-90756 will get some idea

________________________________________________________________________
Zameer Abdulla
Visit Me
No two children are alike - particularly if one is yours and the other isn't.
 
Hi

Private Sub btnExcel_Click()

Dim fso As Object
Dim strFile As String

Set fso = CreateObject("Scripting.FileSystemObject")

strFile = "C:\FileNameWithFullPath.xls"

If (fso.FileExists(strFile)) Then
Call Shell("excel.exe C:FileNameWithFullPath.xls", vbNormalFocus)
Exit Sub
Else
MsgBox "Excel File Specified In Path not Found.", vbInformation, "Open Excel File"
End If

End Sub

Mark...

[Worm]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top