Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Import old dos sequencial data

I have an old database that stored it's data in a sequencial format with
fixed lengths for each field. As Windows 7 64-bit no longer allows the
running of the database I need to access the data in another way so wish to
import it to excel. I can get as far as marking the first record's field
lengths but there does not seem to be a way of marking the end of the record.
Instead it leaves the rest of the data in the final field!

Can anyone suggest the best way of doing this? Thank you.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 126
Default Import old dos sequencial data

You would need a macro for this.
1st you have to change that file from sequential to 1 line per record.
Since you know the exact fixed length of each field, you know the exact
fixed length of each record.
Using the OPEN, WRITE and CLOSE statements, you can grab each record length,
throw in a carriage return [Chr(13)], form feed [Chr(12)] or line feed
[Chr(10)] at the end of each record, save the file and then pull it up in
Excel using Text to Columns - fixed length.

--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Rich Stone" wrote:

I have an old database that stored it's data in a sequencial format with
fixed lengths for each field. As Windows 7 64-bit no longer allows the
running of the database I need to access the data in another way so wish to
import it to excel. I can get as far as marking the first record's field
lengths but there does not seem to be a way of marking the end of the record.
Instead it leaves the rest of the data in the final field!

Can anyone suggest the best way of doing this? Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 46
Default Import old dos sequencial data

You can try out the below macro to read this file and place this to excel
activesheet. If you are new to macros.. (Please note to change the
recordlength as needed)

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()


Sub Macro2()
Dim intFile As Integer, strFile As String
Dim intLen As Integer, lngRow As Long

strFile = "c:\test.txt"
intLen = 10

intFile = FreeFile
Open strFile For Input As #intFile
Do While Not EOF(intFile)
lngRow = lngRow + 1
Range("A" & lngRow) = Input(intLen, #intFile)
Loop
Close intFile
End Sub


"Rich Stone" wrote:

I have an old database that stored it's data in a sequencial format with
fixed lengths for each field. As Windows 7 64-bit no longer allows the
running of the database I need to access the data in another way so wish to
import it to excel. I can get as far as marking the first record's field
lengths but there does not seem to be a way of marking the end of the record.
Instead it leaves the rest of the data in the final field!

Can anyone suggest the best way of doing this? Thank you.

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
Sequencial FIXED Numbering ev Excel Discussion (Misc queries) 1 January 18th 10 04:26 PM
Sequencial Names On Worksheet Tabs lehigh46 Excel Worksheet Functions 3 January 29th 09 12:52 PM
Linked sheets with sequencial order in 2ΒΊ Sheet Micos3 Excel Discussion (Misc queries) 0 February 14th 06 05:34 PM
Sequencial file names Neville Excel Discussion (Misc queries) 1 February 14th 06 02:48 PM
offset problem list not sequencial steve alcock Excel Worksheet Functions 3 May 23rd 05 02:56 PM


All times are GMT +1. The time now is 03:46 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"