View Single Post
 
Old June 29th, 2007, 01:51 AM
Shasur Shasur is offline
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

It would be bettter to have that as a query table

Sub TXT_QueryTable()

Dim ConnString As String

Dim qt As QueryTable

ConnString = "TEXT;C:\Temp.txt"


Set qt = Worksheets(1).QueryTables.Add(Connection:=ConnStri ng, _
        Destination:=Range("B1"))

qt.Refresh



End Sub

This will apply if you have the same text file that is getting appended. If it changes then change the Connection string

Also you can refresh the Excel every time it gets opened using qt.Refresh


Private Sub Workbook_Open()
Dim qt As QueryTable
Set qt = ActiveWorkbook.Sheets(1).QueryTable(1)
qt.Refresh

End Sub

Cheers
Shasur


http://www.vbadud.blogspot.com