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

how do I open a file in VB6

Status
Not open for further replies.

bowz75

IS-IT--Management
Oct 19, 2006
21
US
I have the following command button on a menu, Excel launches, but how do I add a specific file (C:\My Documents\xxx.xls).

Private Sub Command32_Click()
On Error GoTo Err_Command32_Click

Dim oApp As Object

Set oApp = CreateObject ("Excel.Application")
oApp.Visible = True
'Only XL 97 supports UserControl Property
On Error Resume Next
oApp.UserControl = True

Exit_Command32_Click:
Exit Sub

Err_Command32_Click:
MsgBox Err.Description
Resume Exit_Command32_Click

End Sub
 

Take a look on the Open method of Workbooks object of excel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top