485 Lec1A.srt485 Lec1B.srt485 Lec2B.srt485 Lec5 09 17 2020.srt485 Lec2A.srtDear experts,
The above excel macro was provided by a Certified expert by name Als315 (acknowledging and giving due credit to the timely help and support.
Speaking about myself, I am not a coder and I cannot code.
The below code does the following:
Now I want to save more than one text file. All the text files will have the same standard form for which the below macro will do the required on a standalone basis.
I will be happy if the above macro can be amended to incorporate the following features
Option Explicit
Sub import_files()
Dim path As String, File As String
Dim Str As String
Dim R As Long, I As Long
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Dim ts As Object
path = "C:\Users\KOTAD\Desktop\Test macro" 'Correct path to your file
File = Dir(path & "\*.srt")
If File = "" Then
MsgBox "File not found", vbOKOnly
Exit Sub
Else
I = 1
Set ts = fso.OpenTextFile(path & "\" & File)
Str = ""
Do While Not ts.AtEndOfStream
Str = ts.ReadLine
If I Mod 4 = 0 Then
Selection.TypeText Text:="//" & Str '& vbCrLf
End If
I = I + 1
Loop
ts.Close
End If
MsgBox "Import finished, file: " & File & " lines: " & I, vbOKOnly
End Sub
Thank you once again for the prompt response/support.
The macro worked perfect.
I will close the question in a day or two
Thank you once again.