you can use v1 via a UDF
Sub vbax_54318_Consolidate_WorkSheets_From_files_In_Same_Folder_v1()
Dim FolderPath As String, tempStr As String
Dim FilesInFolder
Dim j As Long, calc As Long
Dim wbDst As Workbook
With Application
.ScreenUpdating = False
.DisplayAlerts = False
.EnableEvents = False
.AskToUpdateLinks = False
calc = .Calculation
.Calculation = xlCalculationManual
End With
FolderPath = "H:\My Documents\Test\"
FilesInFolder = Split(CreateObject("WScript.Shell").Exec("cmd /c Dir """ & FolderPath & "*.xl??"" /b").StdOut.ReadAll, vbCrLf)
Set wbDst = Workbooks.Add(xlWBATWorksheet)
For j = LBound(FilesInFolder) To UBound(FilesInFolder)
If Len(FilesInFolder(j)) > 4 Then
tempStr = FilesInFolder(j)
tempStr = StripAccentNorsk(tempStr)
FilesInFolder(j) = tempStr
With GetObject(FolderPath & FilesInFolder(j))
.Worksheets(1).Copy After:=wbDst.Worksheets(wbDst.Worksheets.Count)
ActiveSheet.Name = "wb_" & j
.Close 0
End With
End If
Next
wbDst.Worksheets(1).Delete
With Application
.EnableEvents = True
.AskToUpdateLinks = True
.Calculation = calc
End With
End Sub
Function StripAccentNorsk(thestring As String)
'http://www.extendoffice.com/documents/excel/707-excel-replace-accented-characters.html
Dim A As String, B As String
Dim i As Integer
Const AccChars = ""
Const RegChars = ""
For i = 1 To Len(AccChars)
A = Mid(AccChars, i, 1)
B = Mid(RegChars, i, 1)
thestring = Replace(thestring, A, B)
Next
StripAccentNorsk = thestring
End Function