Drop Multiple Files/Folders to VBS File

Rekd

Banned
Joined
Apr 28, 2010
Messages
136
I've got a VBS file that I'm using to populate an excel spreadsheet with file names. I select the files (.pdf's or .slddrw's of mechanical drawings) and drop them on the script, it iterates through the files and puts them into the spreadsheet with their folders.

My problem is that I can only drop as many as 21 files at a time. Some of the assemblies I do have as many as a couple hundred parts (files).

The code I'm currently using is below, but is there a way to make it so I can drop more files?

Code:
Dim arg, cnt
Set objExcel = CreateObject("Excel.Application")
If WScript.Arguments.Count = 0 Then
   WScript.Echo  "Drop files on this script to load into Excel spreadsheet."
Else
objExcel.Visible = True
objExcel.Workbooks.Add
   For each arg in WScript.Arguments 
 cnt = cnt + 1
objExcel.Cells(cnt, 1).Value = arg
   Next
End If
WScript.Quit(0)

I've been doing this by running a command window in the folder, doing a DIR /s /b *.pdf > files.txt then importing that into Excel, but it's too much work. (I'm lazy).

Thanks in advance.
 
Last edited:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

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