I am trying to get folderpath and then looping for Excel sheet in this folder
Imports Excel= Microsoft.Office.Interop.Excel
Public Sub Combine()
Dim objApp As Excel.Application
Dim objBook As Excel.Workbook
Dim objSheet As Excel.Worksheet
Dim myrange As Excel.Range
Dim folderPath As String
Dim fileName As String
folderPath = @"FolderPath"
fileName = Dir(folderPath & "*.xls")
Do While (fileName <> "")
objBook = objApp.Workbooks.Open(Filename:=Txt_GetPath.Text & fileName = True)
objBook.Activate()
For Each objSheet In objBook.Sheets
objSheet.Copy(After:=objBook.Sheets(1))
Next objSheet
objBook.Close()
Loop
End Sub
But at the line objBook =objApp.Workbooks.open(...)
I get an error of
The path must be full
What is wrong with the code?