Hope so this might solve your half the problem.

This function may be used for opening a list of files in a given
folder and then open each of the file and close the file.
This can be directly used in word VBA itself.
But before running this procedure add reference as "Microsoft Running
script".



Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim FSO As Scripting.FileSystemObject
Dim SourceFolder As Scripting.Folder
Dim FileItem As Scripting.File

Dim SourceFolderName As String



Dim myDoc As Document

SourceFolderName = InputBox("Enter The Folder Where all files are
stored")

    Set FSO = New Scripting.FileSystemObject
    Set SourceFolder = FSO.GetFolder(SourceFolderName)

    For Each FileItem In SourceFolder.Files

        If FileItem.Type = "Microsoft Word Document" Then
            Set myDoc = Application.Documents.Open(FileItem.path)
            myDoc.Save
            myDoc.Close
        End If
    Next FileItem


    Set FileItem = Nothing
    Set SourceFolder = Nothing
    Set FSO = Nothing

Application.ScreenUpdating = True

End Sub


--~--~---------~--~----~------------~-------~--~----~
Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/excel-macros?hl=en

Visit & Join Our Orkut Community at 
http://www.orkut.com/Community.aspx?cmm=22913620

Visit the blog to download Excel tutorials at 
http://www.excel-macros.blogspot.com

To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com

To see the Daily Excel Tips, Go to:
http://exceldailytip.blogspot.com
-~----------~----~----~----~------~----~------~--~---

Reply via email to