Private Sub Command1_Click()
Dim xlapp As New Excel.Application
Dim xlwkbook As New Excel.Workbook
Set xlapp = CreateObject("Excel.application")
'Note: This spreadsheet must exist prior to running this code
Set xlwkbook = xlapp.Workbooks.Open(App.Path & "Book1.xls")
xlapp.Visible = True
With xlapp.ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;c:\windows\temp\virus.txt", Destination:=Range("A1"))
.Name = "update popup dont show"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.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)
.TextFileFixedColumnWidths = Array(22, 4, 3, 2, 2, 2)
.Refresh BackgroundQuery:=False
End With
xlwkbook.SaveAs ("Test.xls")
xlwkbook.Close
Set xlapp = Nothing
End Sub