Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default excel 2000 & importing text files

I have used a query table to import a text file with fixed widths in excel
2003 on my home computer.
But when I open the file at work which uses office 2000 my text document is
loaded into one cell, instead of the supposed 4 cells & not starting at A1
but D1.
I have tried changing the fixed width array and the column data types to no
avail. can anyone say why this will work in office 2003 but not 2000?? and
make any suggestions??

the code:

Sub Getfile()
Dim fname As String
fname = Application.GetOpenFilename _
(filefilter:="Text Files(*.txt),*.txt,All Files (*.*),*.*")


If fname = "False" Then
MsgBox "You Did'nt select a file"
Exit Sub
End If

Set myquery = Workbooks(1).Worksheets(2)
Set muncb = myquery.QueryTables _
.Add(Connection:="TEXT;" & fname, _
Destination:=myquery.Cells(1, 1))
With muncb
.TextFileParseType = xlFixedWidth
.TextFileFixedColumnWidths = Array(10, 10, 10, 10)
.TextFileColumnDataTypes = _
Array(xlTextFormat, xlTextFormat, xlTextFormat, xlTextFormat)
.Refresh
End With

End Sub

Thanks Anthony
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
Excel - Importing Text Files PW11111 Excel Discussion (Misc queries) 2 September 6th 06 04:51 PM
Importing text files to Excel with big numbers Orjan Excel Worksheet Functions 0 March 17th 05 07:13 PM
Importing text files into Excel Christopher Anderson Excel Discussion (Misc queries) 2 December 4th 04 05:57 PM
importing several text files into different excel worksheet annsmjarm Excel Programming 1 September 15th 04 01:25 PM
Excel 2000 importing huge ASCII files into different sheets Goran Stjepanovic Excel Programming 2 February 25th 04 09:30 AM


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

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"