Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
file name reuse
Dim vArray as Variant
vArray = Application.GetOpenFilename( _ FileFilter:="Text Files (*.adv), *.adv", FilterIndex:=1, _ Title:="Copy Text File To Worksheet",MultiSelect:=True) If isarray(vArray) Then for i = lbound(vArray) to ubound(vArray) Workbooks.OpenText Filename:=vArray(i),_ Origin:=xlWindows, StartRow:=1, _ DataType:=xlFixedWidth, _ FieldInfo:= _ Array(Array(0, 9), Array(22, 2), Array(30, 9)) Next End If -- Regards, Tom Ogilvy "milus" wrote in message m... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
file name reuse
"Tom Ogilvy" wrote in message ...
Dim vArray as Variant vArray = Application.GetOpenFilename( _ FileFilter:="Text Files (*.adv), *.adv", FilterIndex:=1, _ Title:="Copy Text File To Worksheet",MultiSelect:=True) If isarray(vArray) Then for i = lbound(vArray) to ubound(vArray) Workbooks.OpenText Filename:=vArray(i),_ Origin:=xlWindows, StartRow:=1, _ DataType:=xlFixedWidth, _ FieldInfo:= _ Array(Array(0, 9), Array(22, 2), Array(30, 9)) Next End If -- Regards, Tom Ogilvy "milus" wrote in message m... I receive plain text files in the form of: snip Tom Thanks for the prompt reply. I'll give it a try after vacation Pat |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Reuse Application.WorksheetFunction | Excel Discussion (Misc queries) | |||
to reuse macros | Excel Discussion (Misc queries) | |||
how can i save my macro if i want to reuse | Excel Worksheet Functions | |||
How can I reuse the same Name on more than one worksheet? | Excel Discussion (Misc queries) | |||
Can you reuse links?? | Excel Programming |