• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Addition to macro code

Anar

Member
Hi everyone


I have code purpose of which is to repeatedly write the same words in several workbooks.


To do that I open all workbooks and run macro in each workbook separately.


The macro writes the required words, then saves the workbook and closes it.


I don't want to run macro manually in each workbook.What kind of addition can I make to the code in order to repeat the same procedure for all open workbooks automatically?


Regards,

Anar
 
Air code

[pre]
Code:
Dim fso As Object
Dim fldr As Object
Dim file As Object

Set fso = CreateObject("Scripting.FilesystemObject")
Set fldr = fso.getFolder("C:test")
For Each file In fldr.Files

Workbooks.Open file.Path

'do your stuff

ActiveWorkbook.Save
ActiveWorkbook.Close
Next file
[/pre]
 
Back
Top