Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, some help would appriciated.
I would like to check some data in a TXT-file. If the worksheet is on a computer without internet-connection, the messagebox "The update failed" should appear. But, in the macro I made, the messagebox always appears, also when the update is done. What am I doing wrong? Sub CheckUpdate() On Error GoTo ErrorMessage With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.domain.com/version.txt", Destination:=Range("C14")) .Name = "test" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .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 ErrorMessage: MsgBox "The update failed" End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub CheckUpdate()
On Error GoTo ErrorMessage With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.domain.com/version.txt", Destination:=Range("C14")) .Name = "test" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .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 ' add a line here to avoid the message: Exit Sub ErrorMessage: MsgBox "The update failed" End Sub -- Regards, Tom Ogilvy "Gert-Jan" wrote: Hi, some help would appriciated. I would like to check some data in a TXT-file. If the worksheet is on a computer without internet-connection, the messagebox "The update failed" should appear. But, in the macro I made, the messagebox always appears, also when the update is done. What am I doing wrong? Sub CheckUpdate() On Error GoTo ErrorMessage With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.domain.com/version.txt", Destination:=Range("C14")) .Name = "test" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .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 ErrorMessage: MsgBox "The update failed" End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, works fine!
"Tom Ogilvy" schreef in bericht ... Sub CheckUpdate() On Error GoTo ErrorMessage With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.domain.com/version.txt", Destination:=Range("C14")) .Name = "test" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .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 ' add a line here to avoid the message: Exit Sub ErrorMessage: MsgBox "The update failed" End Sub -- Regards, Tom Ogilvy "Gert-Jan" wrote: Hi, some help would appriciated. I would like to check some data in a TXT-file. If the worksheet is on a computer without internet-connection, the messagebox "The update failed" should appear. But, in the macro I made, the messagebox always appears, also when the update is done. What am I doing wrong? Sub CheckUpdate() On Error GoTo ErrorMessage With ActiveSheet.QueryTables.Add(Connection:= _ "URL;http://www.domain.com/version.txt", Destination:=Range("C14")) .Name = "test" .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .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 ErrorMessage: MsgBox "The update failed" End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
changes in destination file should update sourse file | Excel Discussion (Misc queries) | |||
Macro to pull data from another file - update name of file | Excel Discussion (Misc queries) | |||
i want to update one excel file the other one update automaticaly | New Users to Excel | |||
Automatic update of links in destination file when source file mo. | Excel Discussion (Misc queries) | |||
Automate open file, update links, run macro, close and save file | Excel Programming |