Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old December 24th, 2017, 01:13 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Dec 2017
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default import text files to excel

i am importing files using this vbascript

Sub Import_All_Text_Files()

Application.ScreenUpdating = False

Dim thisRow As Long
Dim fileNum As Integer
Dim strInput As String

Const strPath As String = "C:\Temp\Temp\" 'Change as required
Dim strFilename As String

strFilename = Dir(strPath & "*.txt")

With ActiveSheet
thisRow = .Range("A" & .Rows.Count).End(xlUp).Row

Do While strFilename <> ""

fileNum = FreeFile()
Open strPath & strFilename For Binary As #fileNum
strInput = Space$(LOF(fileNum))
Get #fileNum, , strInput
Close #fileNum

thisRow = thisRow + 1
.Cells(thisRow, 1).Value = strInput

strFilename = Dir
End With

Application.ScreenUpdating = True
End Sub

but the problem is i can't able to import other language text files. so please add utf-8 code to this script so i can import all text files in any language.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Import from Excel sheet to a text file zone Excel VBA 1 July 26th, 2007 10:34 AM
import data from text file to excel(VBA) topr Excel VBA 2 August 26th, 2004 11:36 PM
Excel IMport Text Help!! money Excel VBA 2 April 30th, 2004 12:43 AM
Excel text Import and VB Franck Excel VBA 0 January 8th, 2004 08:57 AM
import .doc files text in access jf17 Access 1 December 10th, 2003 02:58 PM

All times are GMT -4. The time now is 05:03 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.