LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 186
Default Error on Import

I have a macro that I use to import a large text file into multiple
worksheets in Excel.
To get these imported I have the following code:

Set oConn = New ADODB.Connection
Set rsInput = New ADODB.Recordset

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & strPath & ";" & _

"Extended Properties=""text;HDR=NO;FMT=FixedLength"""

rsInput.Open "SELECT * FROM " & FileOpenNameF827, oConn, adOpenStatic,
adLockOptimistic, adCmdText

If rsInput.RecordCount 0 Then
Counter = 1
ActiveSheet.Name = "F827"

rsInput.MoveFirst
While Not rsInput.EOF
ActiveSheet.Cells(1, 1).CopyFromRecordset rsInput, 65000
If Not rsInput.EOF Then
Counter = Counter + 1
Sheets.Add
ActiveSheet.Name = "F827(" & Counter & ")"
End If
Wend
End If
rsInput.Close

I also have the following in a schema.ini file:

[F827.txt]
Format=FixedLength
ColNameHeader=False

Col1=GLAcctNo Text Width 5
Col2=GLName Text Width 9
Col3=Lim Text Width 3
Col4=Anal Text Width 5
Col5=AO Text Width 5
Col6=TC Text Width 3
Col7=TT Text Width 3
Col8=DocID Text Width 12
Col9=DocLin Text Width 4
Col10=BatchNo Text Width 7
Col11=TransDate Text Width 9
Col12=AccDate Text Width 9
Col13=RefTC Text Width 3
Col14=RefNo Text Width 12
Col15=RefLn Text Width 4
Col16=DrAmt Double Width 20
Col17=CrAmt Double Width 20

The import works on my machine. I have sent the macro and ini file to about
20 other users. For a few of them, instead of importing and parsing the text
file into 17 cloumns, the data is being parsed into only two columns; column
A includes all the data that is supposed to parsed into columns 1-16 and
column B has the data that is supposed to be column 17.

The users have the same Excel version as me.

Any clues as to what might be happening?

--
Ken Hudson
 
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
XML Import Parsing error Jeff Excel Discussion (Misc queries) 1 October 10th 09 10:50 AM
Connection/Import Error msgs Trudye[_2_] Excel Programming 0 March 20th 06 07:51 PM
Excel 2000 Import Error ken4capitola Excel Programming 2 November 22nd 05 11:22 PM
Import sheet error Edgar Thoemmes[_4_] Excel Programming 1 February 18th 05 12:45 PM
HTML/XML Import Error -ExcelName smcclure Excel Programming 0 October 22nd 04 06:19 AM


All times are GMT +1. The time now is 04:26 AM.

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

About Us

"It's about Microsoft Excel"