Results 1 to 2 of 2

Import Text file ActiveSheet.QueryTables.Add

Threaded View

foncesa Import Text file... 10-24-2014, 05:13 PM
Leith Ross Re: Import Text file... 10-24-2014, 05:41 PM
  1. #1
    Registered User
    Join Date
    01-23-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    18

    Import Text file ActiveSheet.QueryTables.Add

    Hi,

    I need to import a text file with this codes, but with some changes to it, like from column A to F as Genaral and Column G as Text.
    I have attached the sample text file.

    FileToOpen = Application.GetOpenFilename("Text Files (*.txt), *.txt")
    s = Split(FileToOpen, "\") 
    t = Split(s(UBound(s)), ".") 
    If FileToOpen = "False" Then Exit Sub
    With ActiveSheet.QueryTables.Add(Connection:= _
            "TEXT;" & FileToOpen, Destination:=Range("$A$" & LastRow))
            .TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1,  xlTextFormat)
            .Refresh BackgroundQuery:=False
    End With
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ActiveSheet.QueryTables.Add - only add 2nd row
    By umbata in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-03-2013, 12:45 PM
  2. ActiveSheet.QueryTables.Add using InputBox and/or a URL list in a .txt file list
    By crazy_vba in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-29-2006, 05:54 PM
  3. [SOLVED] ActiveSheet.QueryTables.Add
    By Rick in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-10-2005, 12:30 AM
  4. RE: ActiveSheet.QueryTables.Add
    By quartz in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-09-2005, 03:25 PM
  5. Adding QueryTables to an activesheet
    By pkrono in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-08-2005, 08:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1