Thread
:
Code can't locate filename
View Single Post
#
3
Posted to microsoft.public.excel.programming
Kassie
external usenet poster
Posts: 17
Code can't locate filename
Hi davidm
You My documents folder does not branch off C:\ directly
The correct path is C:\Documents and Settings\username\My Documents. Just
add your username to the line, and it should pick up
--
ve_2nd_at. Randburg, Gauteng, South Africa
"davidm" wrote:
The following code fails to locate the filename path specified
returning "file not found" error. There is surely a file named
"tester'" in C:\ Mydocuments folder. What gives? TIA
Sub Import_TextFiles1()
Dim RwIndx As Integer
Dim ColIndx As Integer
Dim WholeLine As String
Dim Fname As String
Application.ScreenUpdating = False
ColIndx = ActiveCell.Column
RwIndx = ActiveCell.Row
Fname = "C:\My Documents\tester.doc"
Open Fname For Input Access Read As #1
While Not EOF(1)
Line Input #1, WholeLine
Cells(RwIndx, ColIndx).Value = WholeLine
RwIndx = RwIndx + 1
Wend
Close #1
Application.ScreenUpdating = True
--
davidm
------------------------------------------------------------------------
davidm's Profile:
http://www.excelforum.com/member.php...o&userid=20645
View this thread:
http://www.excelforum.com/showthread...hreadid=387955
Reply With Quote
Kassie
View Public Profile
Find all posts by Kassie