Thanks Dave, I'll give it a try when I get back to work tomorrow. Regards, Steve
On Jan 18, 3:46 am, Dave Bonallack <davebonall...@hotmail.com> wrote: > Hi Steve, > Ignore the first email. It was incomplete. > Try this. Remember the extra End With near the end. > Regards - Dave. > > Dim myFileName As Variant > myFileName = Application.GetOpenFilename(filefilter:="Text Files, *.txt") > If myFileName = False Then Exit Sub 'user hits cancel > > With ActiveSheet > With .QueryTables.Add(Connection:="TEXT;" & myFileName, > Destination:=.Range("A1")) > > > > > > > > > .FieldNames = True > > .RowNumbers = False > > .FillAdjacentFormulas = False > > .PreserveFormatting = True > > .RefreshOnFileOpen = False > > .RefreshStyle = xlInsertDeleteCells > > .SavePassword = False > > .SaveData = True > > .AdjustColumnWidth = True > > .RefreshPeriod = 0 > > .TextFilePromptOnRefresh = False > > .TextFilePlatform = 437 > > .TextFileStartRow = 1 > > .TextFileParseType = xlFixedWidth > > .TextFileTextQualifier = xlTextQualifierDoubleQuote > > .TextFileConsecutiveDelimiter = False > > .TextFileTabDelimiter = True > > .TextFileSemicolonDelimiter = False > > .TextFileCommaDelimiter = False > > .TextFileSpaceDelimiter = False > > .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, > > 1, 1, 1, 1, 1, 1, 1, 1, 1) > > .TextFileFixedColumnWidths = Array(20, 88, 60, 6, 2, 60, 30, > > 12, 1, 20, 4, 9, 6, 12, 10, _ > > 10, 12) > > .TextFileTrailingMinusNumbers = True > > .Refresh BackgroundQuery:=False > > End With > End With > > End Sub > > > Any help would be greatly appreciated. > > > Thanks, > > > Steve > > _________________________________________________________________ > It's simple! Sell your car for just $40 at > CarPoint.com.auhttp://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworl...- > Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To post to this group, send email to excel-macros@googlegroups.com For more options, visit this group at http://groups.google.com/group/excel-macros?hl=en Visit & Join Our Orkut Community at http://www.orkut.com/Community.aspx?cmm=22913620 To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com To see the Daily Excel Tips, Go to: http://exceldailytip.blogspot.com If you find any spam message in the group, please send an email to Ayush @ jainayus...@gmail.com -~----------~----~----~----~------~----~------~--~---