Hello,
I need to have a macro create a new folder in 8 other folders and name them based on what is in cell A168 from the workbook that holds the macro.
Once a person clicks on the button to process the macro, the macro should look in cell A168 and create new folder in each of the 8 main folders. The folder locations are:
The macro would look at cell A168 and then add a folder into each of these locations.
Here is the code I use now to create a new folder in each of these folders. The issue is there is a pop up saying it has created a new folder 8 times. I'm just trying to reduce the macro size but accomplish the same thing.
I need to have a macro create a new folder in 8 other folders and name them based on what is in cell A168 from the workbook that holds the macro.
Once a person clicks on the button to process the macro, the macro should look in cell A168 and create new folder in each of the 8 main folders. The folder locations are:
Code:
\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Inventory\
\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Order Status\
\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Pars - Active Moves\
\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Pars - Storage\
\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Remarketing Data\
\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Renewal Status\
\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Tag Expiration\
\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Violations\
The macro would look at cell A168 and then add a folder into each of these locations.
Here is the code I use now to create a new folder in each of these folders. The issue is there is a pop up saying it has created a new folder 8 times. I'm just trying to reduce the macro size but accomplish the same thing.
Code:
Sub MakeMyFolderInventory()
'This macro creates a new folder based on what is in cells A168 in the Inventory folder.
Dim fdObj As Object
Application.ScreenUpdating = False
Set fdObj = CreateObject("Scripting.FileSystemObject")
If fdObj.FolderExists("\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Inventory\" & [A168]) Then
MsgBox "Your folder is already here and ready!.", vbInformation, "Your folder is found!"
Else
fdObj.CreateFolder ("\\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Inventory\" & [A168])
MsgBox "Your new folder has been created.", vbInformation, "Create a new folder!"
End If
Application.ScreenUpdating = True
'Below opens a folder where your invoices will be stored.
Dim retVal As Long
retVal = Shell("explorer.exe \\fleet.ad\data\Data1\VMSSHARE\FS\FPSCOEASSO\Temporary Fleet Reports\313670 Avanir\Inventory\" & [A168], vbNormalFocus)
End Sub