RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 810
- Office Version
- 365
- Platform
- Windows
Hi guys, I've seen a few threads like this scattered around the forums but haven't found anything too definitive.
The below code allows me to open a default directory, select multiple files and set them as what I want. However, it doesn't seem to want to apply them to the text box "CampList" I have within a userform.
What I'd like to do is, say I select 3 files, have all three file names separated by carriage return listed in the text box.
The file would look something like this:
I'm planning to grab the final portion of the filename string using this:
Which should grab the text after the final "\"
But for now, I just need to get the tour names loaded into the CampList text box. Thanks.
The below code allows me to open a default directory, select multiple files and set them as what I want. However, it doesn't seem to want to apply them to the text box "CampList" I have within a userform.
VBA Code:
Dim i As Integer
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = True
.InitialFileName = "\\chw-dc03\company\Sales"
.Filters.Clear
.Filters.Add "Excel Files", "*.xls*"
If .Show = True Then
For i = 1 To .SelectedItems.Count
CampList.Text = SelectedItems(i)
Next i
End If
End With
What I'd like to do is, say I select 3 files, have all three file names separated by carriage return listed in the text box.
The file would look something like this:
\\chw-dc03\company\sales\2. RT 2021 UK Preview (A1-A6) Report 20.10.2020.xlsx
I'm planning to grab the final portion of the filename string using this:
VBA Code:
Sp = Split(facml, "\")
camnam = Trim(Left(Sp(UBound(Sp)), InStr(1, Sp(UBound(Sp)), "mailing", vbTextCompare) - 1))
Which should grab the text after the final "\"
But for now, I just need to get the tour names loaded into the CampList text box. Thanks.