Everything runs just fine until I try and save the spreadsheet under a
different name and/or a different directory. Then I get the same error
I referenced in the initial posting. So to alleviate that problem, I
was trying to get it to simply bypass the procedure calls, because I
don't want copies of the spreadsheet to update the file anyway.
Adding the On Error GoTo commands causes the error mentioned.
____________
Private Sub Workbook_Open()
Call copy
End Sub
Sub copy()
On Error GoTo Last
FileCopy "\\0.0.0.0\customer\data.txt", "c:\cabg\data.txt"
Call upload
Exit Sub
Last:
End Sub
Sub upload()
On Error GoTo Last2
With
ActiveSheet.QueryTables.Add(Connection:="TEXT;C:\cabg\data.txt", _
Destination:=Range("A2"))
.Name = "cabg"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = False
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = xlWindows
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.Refresh BackgroundQuery:=False
End With
Exit Sub
Last2:
End Sub