Thread: file name reuse
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
milus milus is offline
external usenet poster
 
Posts: 6
Default file name reuse

I receive plain text files in the form of:


ADV1 R0001 040713VORVOR04072 9001229583
-H-07-05000036800000001305000000000
ADV218235592 PLUG-DRAIN 00005UOI0005EA
00005KY9001229583
ADV1 R0001 040713VORVOR04072 9001229583 ...

I open the files in Excel97 using the following code to isolate a
particular bits of information. The I reopen the file after changing
the fixed width arrays to isolate the next set of data. This is
repeated 8 times. How do I write the full file name to a cell to
automate the procedure? Thanks.

Dim sFile

sFile = Application.GetOpenFilename( _
FileFilter:="Text Files (*.adv), *.adv", FilterIndex:=1, _
Title:="Copy Text File To Worksheet")
If sFile < False Then
Workbooks.OpenText Filename:=sFile,_
Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth,
FieldInfo:= _
Array(Array(0, 9), Array(22, 2), Array(30, 9))
End If