Hi,
I have this code to search in the specified folder for the file whose name starts with the user input. I havejust placed msg boxes to check if he code works till there. but I am not able t reach the second msg box. could anybody help me.
code placed here
I have this code to search in the specified folder for the file whose name starts with the user input. I havejust placed msg boxes to check if he code works till there. but I am not able t reach the second msg box. could anybody help me.
code placed here
Code:
Sub CopytoSum()
Dim fname As String
Dim fpath As String
Dim sumfile As String
Dim xlfile As Workbook
fninput = InputBox("Please enter the name of the company", Title:="ENTER COMPANY NAME", Default:="Enter Name here")
fninput = fname
MsgBox "over"
If fninput = "ENTER COMPANY NAME" Or invinput = vbNullString Then
Exit Sub
Else
fpath = "L:\EXIM\SOFTEX FORMS\Summary\"
sumfile = Dir(fpath & "fname*.*")
MsgBox "secondover"
Do While sumfile <> " "
Set xlfile = Workbooks.Open(Filename:=fpath & sumfile)
MsgBox "thirdover"
sumfile = Dir()
Loop
End If
End Sub