Hi there, I need a little help with this VBA Macro: Sub ImportTextFile() Dim FilePath As String FilePath = Application.GetOpenFilename("Text Files (*.txt),*.txt", , "Select Text File", , False) If FilePath = "False" Then Exit Sub With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & FilePath, Destination:=Cells(ActiveCell.Row, ActiveCell.Column)) .PreserveFormatting = True .SaveData = True .AdjustColumnWidth = False .TextFileParseType = xlFixedWidth .TextFileTextQualifier = xlTextQualifierDoubleQuote .TextFileConsecutiveDelimiter = True .TextFileSpaceDelimiter = True .TextFileFixedColumnWidths = Array(1,1,1,1,1) .Refresh BackgroundQuery:=False .Delete End With
End Sub This works perfectly but splits the content of the txt selected file on multiple rows and columns starting from the selected cell. I want that the whole content of the selected txt file to fit only the selected cell, as it happens when i paste the text on the formula bar of a cell. I need to be able to select a cell and with this macro selecting a txt file and having it imported on the selected cell. Then move to another cell and do it again with another txt file. I've tryied to mess around with the Destination value and also with the TextFileFixedColumnWidths and TextFileParseType parameters but nothing changed. Hope someone will be able to help me. Thanks for your kind attention. BeRpF --~--~---------~--~----~------------~-------~--~----~ 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 Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com To see the Daily Excel Tips, Go to: http://exceldailytip.blogspot.com -~----------~----~----~----~------~----~------~--~---