Delta Star
Board Regular
- Joined
- Oct 28, 2009
- Messages
- 184
I have a userform which allows me to create individual reports on mass.
This is accomplished via a userform which contains two combo boxes. The first is populated when opened (with counties) and once a selection is made the second box (towns) is populated.
The user then selects as many towns as they want and click a button which allows the user to decide which folder to place the reports in.
I need to ammend this so that once a folder is chose, a new folder is created automatically and named after the county that was selected from the first combobox and the reports saved to this newly created folder.
To complicate matters further, if the folder already exists then the reports should be added to it.
The code I'm using to select folder is shown below:-
This is accomplished via a userform which contains two combo boxes. The first is populated when opened (with counties) and once a selection is made the second box (towns) is populated.
The user then selects as many towns as they want and click a button which allows the user to decide which folder to place the reports in.
I need to ammend this so that once a folder is chose, a new folder is created automatically and named after the county that was selected from the first combobox and the reports saved to this newly created folder.
To complicate matters further, if the folder already exists then the reports should be added to it.
The code I'm using to select folder is shown below:-
HTML:
Option Explicit
Function PickFolder(strStartDir As Variant) As String
Dim SA As Object, F As Object
Set SA = CreateObject("Shell.application")
Set F = SA.BrowseForFolder(0, "Choose a folder", 0, strStartDir)
If (Not F Is Nothing) Then
PickFolder = F.items.Item.Path
End If
Set F = Nothing
Set SA = Nothing
End Function
Last edited: