VBA to copy huge .txt file

Status
Not open for further replies.

Bragato

New Member
Joined
Nov 26, 2017
Messages
7
I'm creating a VBA code to read a .txt with aproximately 10k lines and 105k words, currently I got this:

Sub GetTxt()
Dim objFSO As Object
Dim objTF As Object
Dim strIn 'As String
Dim X


PilarTxt = Range("C1")


Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTF = objFSO.OpenTextFile(Sheets("Controle").Range("C3") & "" & PilarTxt & "\PARTEPL.LST", 1)
strIn = objTF.readall
X = Split(strIn, vbNewLine)
[b3].Resize(UBound(X) + 1, 1) = Application.Transpose(X)
objTF.Close


End Sub

It reads the .txt and inputs it to the B3 and downward cells.
It's very good, because it's the faster one I found online, but it doesn't copy all of the .txt data.

Can anyone help me solve this? A fast script to read all of the .txt?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Duplicate https://www.mrexcel.com/forum/excel-questions/1038160-reading-huge-txt-file.html#post4983297

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread. Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).

Note that sometimes posts from new users require Moderator approval before you can see them on the public forums. When this happens, you should see a message to that effect when you try to post it. Please be patient and do not attempt to post the question again.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top