Code Not Compatible with XL2003

Tricky

Board Regular
Joined
Jun 8, 2002
Messages
75
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: 4

Tricky

Board Regular
Joined
Jun 8, 2002
Messages
75
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.
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
56,655
Office Version
  1. 365
Platform
  1. Windows
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).
 

Watch MrExcel Video

Forum statistics

Threads
1,127,663
Messages
5,626,163
Members
416,166
Latest member
Archimed

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
Top