Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
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
Reuse Application.WorksheetFunction jlclyde Excel Discussion (Misc queries) 4 March 12th 09 08:32 PM
to reuse macros pol Excel Discussion (Misc queries) 5 October 17th 08 09:29 PM
how can i save my macro if i want to reuse word 2003 problem Excel Worksheet Functions 2 September 19th 05 05:50 PM
How can I reuse the same Name on more than one worksheet? Trevor Heywood Excel Discussion (Misc queries) 2 April 7th 05 03:57 PM
Can you reuse links?? stan clark Excel Programming 0 June 7th 04 01:08 AM


All times are GMT +1. The time now is 10:00 PM.

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

About Us

"It's about Microsoft Excel"