save all work in a directory and run the macro and choose taht directory



Function SelectFolder(Optional Title As String, Optional TopFolder _
As String) As String
Dim objShell As New Shell32.Shell
Dim objFolder As Shell32.Folder
Set objFolder = objShell.BrowseForFolder _
(0, Title, 1, TopFolder)
If Not objFolder Is Nothing Then
SelectFolder = objFolder.Items.Item.Path
End If
End Function

Sub FORMATMULTIPLE()

application.screenupdating = false

' tool -> reference -> Microsoft shell control and automation
Dim fldpth As String
Dim fld, fil As Object
Dim j, a As Long
Dim ask, ask2 As Workbook
fldpth = SelectFolder("Select Folder", "")
Set fso = CreateObject("scripting.filesystemobject")
Set fld = fso.getfolder(fldpth)

For Each fil In fld.Files

Set ask2 = Workbooks.Open(fil.Path)
ask2.Activate

------------------ paste your code for activeworkbook here



ask2.Close
Next fil
 application.screenupdating = true

End Sub
























On Wed, Apr 27, 2011 at 2:15 AM, Muni <muni.r...@gmail.com> wrote:

> Hi Srinivas,
>
> if all the files are under same folder than u can write an macro which
> opens each file automatically and then which runs your macro for formatting.
>
> You can use fso file object and then you can open each file in the folder
> using the for next where u can call ur macros
>
> Hope this might help.
>
> Please let me know if you need any further help on this
>
>
> On Tue, Apr 26, 2011 at 11:46 AM, Chidurala, Shrinivas <
> shrinivas.chidur...@citi.com> wrote:
>
>> Please help.
>>
>> Regards,
>> Shrinivas
>> Citi(r) Global Transaction Services - India
>> UB City, Canberra Block, # 24, Vittal Mallya Road,
>> Bangalore - 56 00 01.
>> Ph    - +91-80-4144 6339 / 6340
>> Email - shrinivas.chidur...@citi.com
>>
>>
>> -----Original Message-----
>> From: Chidurala, Shrinivas [ICG-GTS]
>> Sent: Monday, April 25, 2011 9:10 PM
>> To: excel-macros@googlegroups.com
>> Subject: Multiple file Formatting
>>
>> Dear Gurus,
>>
>> I have created the attached macro for formatting of 50 to 60 files
>> everyday which are receive from system. But to run this macro i need to open
>> and then run. It taking too much time.
>>
>> Please can you advise to prepare the macro which will give facility do
>> similar formatting of all files at a time, if i save all files in specific
>> folder.
>>
>> Find attached sample file for your reference.
>>
>> Thanks in Advance
>>
>> Regards,
>> Shrinivas
>>
>> --
>>
>> ----------------------------------------------------------------------------------
>> Some important links for excel users:
>> 1. Follow us on TWITTER for tips tricks and links :
>> http://twitter.com/exceldailytip
>> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
>> 3. Excel tutorials at http://www.excel-macros.blogspot.com
>> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
>> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>>
>> To post to this group, send email to excel-macros@googlegroups.com
>>
>> <><><><><><><><><><><><><><><><><><><><><><>
>> Like our page on facebook , Just follow below link
>> http://www.facebook.com/discussexcel
>>
>
>
>
> --
> Regards
> Muni
>
> --
>
> ----------------------------------------------------------------------------------
> Some important links for excel users:
> 1. Follow us on TWITTER for tips tricks and links :
> http://twitter.com/exceldailytip
> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
> 3. Excel tutorials at http://www.excel-macros.blogspot.com
> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>
> To post to this group, send email to excel-macros@googlegroups.com
>
> <><><><><><><><><><><><><><><><><><><><><><>
> Like our page on facebook , Just follow below link
> http://www.facebook.com/discussexcel
>



-- 
*Regards*
* *
*Ashish Koul*
*akoul*.*blogspot*.com <http://akoul.blogspot.com/>
*akoul*.wordpress.com <http://akoul.wordpress.com/>
My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830>


P Before printing, think about the environment.

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to