Hi I am trying to combine a bunch of large documents into one word file. When the files gets too big it seams that the macro will open it and start to write it but will then continue on with the next command before the first one is finished. If I add a sleep command it will get farther into the document but this is such an ugly slow way to get this done.
Do While DSPName <> ""
Selection.TypeText Text:=vbNewLine & DSPName
Selection.Style = ActiveDocument.Styles("Appendix A 2")
Selection.TypeText Text:=Chr(13)
Selection.ClearFormatting
Selection.Font.Size = 8
Selection.Font.Name = "Courier New"
FileContents = ImportData(Folder & DSPName)
Selection.TypeText Text:=FileContents & vbNewLine //Large file to input
Sleep 10 //sleep helps but it waste a ton of time
Selection.TypeText Text:="Done" //Once it hits this input it seems to stop inputting the above text whether it was completed or not
DSPName = Dir()
Loop
Do While DSPName <> ""
Selection.TypeText Text:=vbNewLine & DSPName
Selection.Style = ActiveDocument.Styles("Appendix A 2")
Selection.TypeText Text:=Chr(13)
Selection.ClearFormatting
Selection.Font.Size = 8
Selection.Font.Name = "Courier New"
FileContents = ImportData(Folder & DSPName)
Selection.TypeText Text:=FileContents & vbNewLine //Large file to input
Sleep 10 //sleep helps but it waste a ton of time
Selection.TypeText Text:="Done" //Once it hits this input it seems to stop inputting the above text whether it was completed or not
DSPName = Dir()
Loop
Last edited: