Code Not Compatible with XL2003

Tricky

Board Regular
Joined
Jun 8, 2002
Messages
77
Sub CreateFolders()

path = InputBox(“Enter the path where you want to create the folders”)
cell = InputBox(“First cell”)

Range(cell).Select
Do While ActiveCell.Value <> “”
MkDir (path & “/” & ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
Loop
End Sub

I was looking for code that would generate new folders from a selected list on an Excel sheet. I found this code with a quick Google search. I'm sure this code probably works well for most folks, but I'm using Excel 2003 (I know, I know... but I like it). So, this code will not run in 2003, it gets stuck on the red lines. Is there a workaround for this? I found other code that works but it has the Output Directory hardwired. I want to be able to choose the output directory before the code executes. Help with this would be most appreciated.
 

Attachments

  • Capture.JPG
    Capture.JPG
    26.7 KB · Views: 7
Selecting a path from a dialog would surely decrease the chance of typing a path incorrectly. The source of the code SOURCE shows such a dialog... I think I'm running into some limitations with Excel 2003. One day, I will be forced to leave it behind. Thanks for your help today.
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Oh, if you want them to browse to the folder to use, that can be done.
However, I do remember the file browse options being changed (so I am not sure that the same code that worked for 2003 works for the later versions).
You might have to use a different method to do that, like using File System Objects.
If you Google "excel vba browse for folder path using file system objects", you will see some tutorials and videos show up that might be of help (unfortunately, I do not have a copy of Excel 2003 to test any of these out myself).
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top