It's been a very long time since i worked in vb6 im a beginner again. I am trying to open a specific excel file in vb6 with a command button. I need a simple code to do this. This is what i have but it doesnt open the file at C:\Users\Henry\desktop\project\test.xls it opens excel but not the file it just shows a grey screen an no workbook and the error msg box opens behind excel. BUT if i put the file on the desktop as C:\Users\Henry\desktop\test.xls it opens fine where am i going wrong? And can someone help me with a simple code to open a specific file ?
Thanks in advance
Private Sub Command2_Click()
On Error GoTo ErrHandler
Dim xlApp As Object
Dim xlWB As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlWB = xlApp.Workbooks.Open("C:\Users\Henry\desktop\project\test.xls")
MsgBox "There is a problem opening that workbook!", vbCritical, "Error!"
Edited by looney2340, 03 February 2013 - 02:24 AM.