Hi,
I need to get further with this assignment. With this code I've found a given data file in my ListBox with search in the folder of my main workbook location:
Public Sub UserForm_Activate()
Dim fso As FileSystemObject
Dim dir As Folder
Dim file As file
Set fso = New FileSystemObject
Set dir = fso.GetFolder(ThisWorkbook.Path & Application.PathSeparator & "Datafiles")
For Each file In dir.Files
If file.Name Like "*" & ".xlsx" Then
ListBox.AddItem (file.Name)
End If
Next
End Sub
But now I need to copy all three Worksheets from the given/chosen datafile into my Main Workbook. How can I do this? It should still be a non local folder, since it should be used in other computers than my own. I havn't made the "Public Sub ListBox_Click ()" yet, since I would wait until I had a solution by one of you nice guys.
Best regards, Emilio
I need to get further with this assignment. With this code I've found a given data file in my ListBox with search in the folder of my main workbook location:
Public Sub UserForm_Activate()
Dim fso As FileSystemObject
Dim dir As Folder
Dim file As file
Set fso = New FileSystemObject
Set dir = fso.GetFolder(ThisWorkbook.Path & Application.PathSeparator & "Datafiles")
For Each file In dir.Files
If file.Name Like "*" & ".xlsx" Then
ListBox.AddItem (file.Name)
End If
Next
End Sub
But now I need to copy all three Worksheets from the given/chosen datafile into my Main Workbook. How can I do this? It should still be a non local folder, since it should be used in other computers than my own. I havn't made the "Public Sub ListBox_Click ()" yet, since I would wait until I had a solution by one of you nice guys.
Best regards, Emilio