Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Possible to Transfer/Open "Read" a text file into VBA Module?

Thanks Joe

"JoeU2004" wrote:

wrote:
Is it possible to Transfer/Open "Read" a text file
into VBA Module?


The following example provides some useful elements. Be sure to read the
notes that follow.

Const path As String = "c:\documents and settings\myname\my
documents\somefile.txt"
Dim data As String
Dim fd As Integer

fd = FreeFile
Open path For Input Access Read As #fd
Do Until EOF(fd)
Line Input #fd, data
' do something useful with data
Loop
Close #fd

Notes:

1. You can use a constant, starting with 1, instead of using FreeFile.

2. If your text file has some structure (e.g. a CSV file), you should also
see the Help page for the Input statement.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Read Only" error when attempting to open EXCEL file Jim Excel Discussion (Misc queries) 1 January 27th 10 06:28 AM
Unable to open a 82 KB XLSM file due to "Too many different cellformats" & "Converter failed to open the file." errors. Phillip Pi Excel Discussion (Misc queries) 0 April 23rd 09 08:53 PM
"Cannot access read-only document" (I get this error when I try to open an Excel file) [email protected] Excel Discussion (Misc queries) 1 June 5th 06 01:15 PM
"Cannot access read-only document" (I get this error when I try to open an Excel file) [email protected] Setting up and Configuration of Excel 1 June 5th 06 01:15 PM
Excel 2002/2003 can not open xls file says "may be read only" Number6 Excel Discussion (Misc queries) 3 December 20th 05 05:25 PM


All times are GMT +1. The time now is 10:56 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"