G
Guest
I have this code, works great in 2003, I open the file in 2000 and the macro
does not access txt file on website, it goes right to the on error message.
If I manually refresh data Data | Refresh Data it will perform the update.
Why does it work ok in 2003 and not 2000?
'
Sub CheckUpdate_Macro()
Dim strCompleteURL As String
strCompleteURL = "URL;http://www.mywebsite.com/update.txt" 'I had a 3 part
url, I thought may have been problem so I combined
Sheets("UPDATE").Select
Sheets("UPDATE").Unprotect "1234"
On Error GoTo ErrorMessage
With ActiveSheet.QueryTables.Add(Connection:= _
strCompleteURL, Destination:=Range("A1"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlPasteDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Exit Sub
ErrorMessage:
MsgBox "The update failed, make sure you are " & _
"connected to the internet."
End Sub
'
Thanks!
Mike
does not access txt file on website, it goes right to the on error message.
If I manually refresh data Data | Refresh Data it will perform the update.
Why does it work ok in 2003 and not 2000?
'
Sub CheckUpdate_Macro()
Dim strCompleteURL As String
strCompleteURL = "URL;http://www.mywebsite.com/update.txt" 'I had a 3 part
url, I thought may have been problem so I combined
Sheets("UPDATE").Select
Sheets("UPDATE").Unprotect "1234"
On Error GoTo ErrorMessage
With ActiveSheet.QueryTables.Add(Connection:= _
strCompleteURL, Destination:=Range("A1"))
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlPasteDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Exit Sub
ErrorMessage:
MsgBox "The update failed, make sure you are " & _
"connected to the internet."
End Sub
'
Thanks!
Mike