May be you need use a Application.GetOpenFileName(Multiselect=True)
Or use Dir("*.xls) on the requirted folder to list all.

Once you have your filelist, just Loop your code to process each one.

NickHK

P.S. I'm sure you have a good reason to put all your code on a single with
":", but it makes it incredibly unreadable.
Do you have something against whitespace ?

"okanem" <okanem.2agobn_1152084302.5327@excelforum-nospam.com> wrote in
message news:okanem.2agobn_1152084302.5327@excelforum-nospam.com...
>
> I managed to put the code per order sheet on one line so I can just
> remove one ' to activate new orders that are on the system instad of
> four or five '
>
> Anyway, here is my code for the first few orders that are already
> there. I have 10000 lines of code in the macro, each line accounting
> for a new order number, from 50054.xls onward to 60000.xls are all
> remed out using a ' before the Workbooks.Open command as I have
> demonstrated for 50002.xls.
>
> Workbooks.Open
> Filename:="\\Ctserver\common\Hawk\System\Orders\50000.xls",
> ReadOnly:=True: Sheets("Hide").Visible = True: Sheets("Hide").Select:
> Range("A4:BB4").Select: Selection.Copy:
> Windows("hawkmasterrep.xls").Activate: Sheets("Data").Select:
> Range("A4").Select: Selection.PasteSpecial Paste:=xlPasteValues,
> Operation:=xlNone, SkipBlanks:=False, Transpose:=False:
> Windows("50000.xls").Activate: Application.CutCopyMode = False:
> ActiveWorkbook.Close (False)
>
> Workbooks.Open
> Filename:="\\Ctserver\common\Hawk\System\Orders\50001.xls",
> ReadOnly:=True: Sheets("Hide").Visible = True: Sheets("Hide").Select:
> Range("A4:BB4").Select: Selection.Copy:
> Windows("hawkmasterrep.xls").Activate: Sheets("Data").Select:
> Range("A5").Select: Selection.PasteSpecial Paste:=xlPasteValues,
> Operation:=xlNone, SkipBlanks:=False, Transpose:=False:
> Windows("50001.xls").Activate: Application.CutCopyMode = False:
> ActiveWorkbook.Close (False)
>
> ' Workbooks.Open
> Filename:="\\Ctserver\common\Hawk\System\Orders\50002.xls",
> ReadOnly:=True: Sheets("Hide").Visible = True: Sheets("Hide").Select:
> Range("A4:BB4").Select: Selection.Copy:
> Windows("hawkmasterrep.xls").Activate: Sheets("Data").Select:
> Range("A6").Select: Selection.PasteSpecial Paste:=xlPasteValues,
> Operation:=xlNone, SkipBlanks:=False, Transpose:=False:
> Windows("50002.xls").Activate: Application.CutCopyMode = False:
> ActiveWorkbook.Close (False)
>
>
> All they do is simply open a read only 50000.xls or 50001.xls etc then
> unhide a sheet called 'Hide', copy and paste special one line of data
> (A4 to BB4) into consecutive rows in the hawkmasterreport.xls, then it
> closes the 5000?.xls sheet.
>
> So what I am after is if the order sheet, lets say 50008.xls, isnt in
> the orders folder then the macro does not attempt to open it without me
> having to go in and make sure the line has a ' at the start of it.
>
> Hope someone can help.
>
> Rgds
> Okanem
>
>
> --
> okanem
> ------------------------------------------------------------------------
> okanem's Profile:

http://www.excelforum.com/member.php...fo&userid=9301
> View this thread: http://www.excelforum.com/showthread...hreadid=558216
>