Hello All
I am trying to modify this piece of code to point to a cell value for the file path instead of hard coding the path which I would have to change for different users.
I have this piece of code that works well with the cell value file path
Any idea's please on how to modify the code
I am trying to modify this piece of code to point to a cell value for the file path instead of hard coding the path which I would have to change for different users.
Code:
Sub Merger()
Dim bookList As Workbook
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set mergeObj = CreateObject("Scripting.FileSystemObject")
Sheets("Pipeline").Select
Rows("7:1000").ClearContents
'change folder path of excel files here
Set dirObj = mergeObj.Getfolder([B]"C:\Users\fred\Desktop\Board\"[/B])
Set filesObj = dirObj.Files
For Each everyObj In filesObj
Set bookList = Workbooks.Open(everyObj)
I have this piece of code that works well with the cell value file path
Code:
Dim fromPath As String
[B]fromPath = Sheets("Details").Range("D2")[/B]
'
If Right(fromPath, 1) <> "\" Then fromPath = fromPath & "\"
Any idea's please on how to modify the code
Last edited: