R
ryguy7272
I found the macro below on this DG a while back.
Sub Foo()
Dim i As Long
Application.ScreenUpdating = False
Documents.Add
With Application.FileSearch
'Search in foldername
..LookIn = "C:\test"
..SearchSubFolders = False
..FileName = "*.doc"
..Execute
For i = 1 To .FoundFiles.Count
If InStr(.FoundFiles(i), "~") = 0 Then
Selection.InsertFile FileName:=(.FoundFiles(i)), _
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.InsertBreak Type:=wdPageBreak
End If
Next i
End With
End Sub
Basically, it copies and pastes everything in folder (or subfolder if the
condition is set to true). I am wondering if there is an easy way to modify
the macro to search all subfolders and copy/paste only certain sections into
a word document, like some kind of summary report. I am looking through
hundreds of word documents, and searching for criteria such as percentage "%"
and 2 or 3 numbers before that, as well as certain key words such as
"Jurisdiction" and "Domicile". Can this be done?
Regards,
Ryan--
Sub Foo()
Dim i As Long
Application.ScreenUpdating = False
Documents.Add
With Application.FileSearch
'Search in foldername
..LookIn = "C:\test"
..SearchSubFolders = False
..FileName = "*.doc"
..Execute
For i = 1 To .FoundFiles.Count
If InStr(.FoundFiles(i), "~") = 0 Then
Selection.InsertFile FileName:=(.FoundFiles(i)), _
ConfirmConversions:=False, Link:=False, Attachment:=False
Selection.InsertBreak Type:=wdPageBreak
End If
Next i
End With
End Sub
Basically, it copies and pastes everything in folder (or subfolder if the
condition is set to true). I am wondering if there is an easy way to modify
the macro to search all subfolders and copy/paste only certain sections into
a word document, like some kind of summary report. I am looking through
hundreds of word documents, and searching for criteria such as percentage "%"
and 2 or 3 numbers before that, as well as certain key words such as
"Jurisdiction" and "Domicile". Can this be done?
Regards,
Ryan--