#1   Report Post  
Posted to microsoft.public.excel.misc
jgmiddel
 
Posts: n/a
Default Update from TXT-file


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


--
jgmiddel
------------------------------------------------------------------------
jgmiddel's Profile: http://www.excelforum.com/member.php...o&userid=32714
View this thread: http://www.excelforum.com/showthread...hreadid=530890

  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Rech
 
Posts: n/a
Default Update from TXT-file

Put

Exit Sub

on the line before ErrorMessage:

--
Jim
"jgmiddel" wrote in
message ...
|
| 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
|
|
| --
| jgmiddel
| ------------------------------------------------------------------------
| jgmiddel's Profile:
http://www.excelforum.com/member.php...o&userid=32714
| View this thread: http://www.excelforum.com/showthread...hreadid=530890
|


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink won't open any other XLS file Jinx1966 Excel Discussion (Misc queries) 2 February 9th 06 08:26 AM
update a closed file via links Rob Robbins Excel Discussion (Misc queries) 2 July 13th 05 09:25 PM
Automatically update from source when file opens P Flater Excel Discussion (Misc queries) 1 March 25th 05 09:41 PM
Excel-What is update file tool? taxoof Excel Discussion (Misc queries) 0 March 22nd 05 03:03 AM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


All times are GMT +1. The time now is 12:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"