Hi evereryone,

With the follwing procedure which intends to retrieve specific text (red square in the above image) from word documents:
Proposta.jpg


Sub Abrir()


Dim FolderName As String
Dim FileName As String
Dim NewDoc As Object
Dim NewWordFile As Object


Dim A As String
Dim r As Integer




Range("A2:B1000").Value = ""
Range("A2").Select


r = 2


FolderName = "C:\Users\njesus\Documents\Os meus documentos\"
FileName = Dir(FolderName & "*.doc*")




Do While FileName <> ""


On Error Resume Next
    Set NewDoc = CreateObject("word.application")
    NewDoc.Application.Visible = False
    Set NewDoc = GetObject(FolderName & FileName)


    A = NewDoc.Range(12, 25)
    Range("A" & r).Value = A
  
    A = NewDoc.Range(200, 500)
    Range("B" & r).Value = A
   
r = r + 1
   
    NewDoc.Close SaveChanges:=wdDoNotSaveChanges
    NewWordFile.Quit
          
FileName = Dir()


Set NewDoc = Nothing
Set NewWordFile = Nothing


Loop


End Sub
works for folders with a few word documents, but for folders with more than 100 documents it is creating huge amount of data and I keep run out of disk space. Can anyone help me understanding why is this happening?

Thank you!

Regards