Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default lots of makros into one makro??


Hi!

I have a folder with hundreds of xls-files. Each file contains the
macro "ALLNUMBERS".
Is there a way that I can run all makros without having to open each
file and run each makro by hand?

THANKS!


--
JVLennox
------------------------------------------------------------------------
JVLennox's Profile: http://www.excelforum.com/member.php...o&userid=32505
View this thread: http://www.excelforum.com/showthread...hreadid=567219

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default lots of makros into one makro??

No, the file has to be open for the code to run.
But you could automate the process:
<psuedo-code
Foldname=get the folder name
filename=dir(foldername & "*.xls") 'Or filter as necessary
do while filename<""
set WB=workbooks.open(filename)
application.run wb.name & "!ALLNUMBERS"
wb.close 'true/false if you want to save changes/or not
loop
<psuedo-code

NickHK

"JVLennox" wrote in
message ...

Hi!

I have a folder with hundreds of xls-files. Each file contains the
macro "ALLNUMBERS".
Is there a way that I can run all makros without having to open each
file and run each makro by hand?

THANKS!


--
JVLennox
------------------------------------------------------------------------
JVLennox's Profile:

http://www.excelforum.com/member.php...o&userid=32505
View this thread: http://www.excelforum.com/showthread...hreadid=567219



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default lots of makros into one makro??


THANKS, to automate is good enough!!

I applied the code, BUT it loops WITHOUT going to the next filename (i
always uses the first file in the folder)
How do I make it take the next file???

THANKS


Code
-------------------
Sub START()
Foldname = "C:\1\"
Filename = Dir(Foldname & "*.xls") 'Or filter as necessary
Do While Filename < ""
Set wb = Workbooks.Open(Foldname & Filename)
'Application.Run wb.Name & "!ALLNUMBERS"
wb.Close 'true/false if you want to save changes/or not
Loop

End Su
-------------------

--
JVLenno
-----------------------------------------------------------------------
JVLennox's Profile: http://www.excelforum.com/member.php...fo&userid=3250
View this thread: http://www.excelforum.com/showthread.php?threadid=56721

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default lots of makros into one makro??


I got it!

I just have to add this line:
Filename = Dir()

THANKS anyway!

--
JVLenno
-----------------------------------------------------------------------
JVLennox's Profile: http://www.excelforum.com/member.php...fo&userid=3250
View this thread: http://www.excelforum.com/showthread.php?threadid=56721

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Makro Fredrik New Users to Excel 2 May 6th 09 06:38 PM
If with a makro Tove Excel Discussion (Misc queries) 1 April 12th 05 01:49 PM
Makro Esrei Excel Discussion (Misc queries) 1 March 1st 05 12:34 PM
Automatic makros in templates Excel 2003 Peter Excel Programming 0 July 2nd 04 09:36 AM
Lots of Frustration - Lots of Arrays, Dynamic Ranges Don't Work, Help With Options Karl Burrows Excel Programming 4 April 17th 04 12:48 PM


All times are GMT +1. The time now is 06:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"