I have written a macro in vba, which opens a text file with notepad, selects all txt and copies it to Excel. I have to process about 100 files daily in this way and I want to spare the flashing images that I observe. The code is working but the problem is that the command
Application.Screenupdating = False
Is not working with the notepad application. I can only use the normal focus, otherwise the code is not working. How can I execute the code below without observing that the notepad file is opened and processed?
My code is:
Sub GetTextFile()
Application.ScreenUpdating = False
Dim MyPath As String
Dim MyFile As String
MyPath = "C:\Users\bgyona02\Desktop\OLAttachments\"
MyFile = Dir(MyPath & "*.txt", vbNormal)
Do While Len(MyFile) > 0
MyFile = Dir
Loop
Debug.Print GetTextFileContent(" C:\Users\bgyona02\Desktop\OLAttachments\" & MyFile)
'MyFile = Shell("C:\WINDOWS\notepad.exe` C:\Users\bgyona02\Desktop\OLAttachments\" & MyFile, vbNormalFocus)
'SendKeys "^a", True '^A selects everything already in the pdf file.
'SendKeys "^c", True
'SendKeys "%fx", True
End Sub
I could not find any working solution about this.