PDA

View Full Version : Open a file



JDone
10-16-2007, 08:37 AM
I am trying to open an excel file by using an input box. I do not want to browse, just type in the path and file name. What am I doing wrong?

PathName = InputBox("enter the path and the name of an Excel file.")
Workbooks.Open fileName:=" & PathName & "

JKwan
10-16-2007, 08:46 AM
PathName = InputBox("enter the path and the name of an Excel file.")
Workbooks.Open Filename:=PathName

Bob Phillips
10-16-2007, 09:51 AM
Dim Pathname As String
Pathname = InputBox("enter the path and the name of an Excel file.")
If Pathname <> "" Then
If Dir(Pathname) <> "" Then
Workbooks.Open Filename:=Pathname
End If
End If