Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using XL 2003.
I have a need to run Internet Explorer for about 20k URLs. This is beyond the capacity of IE on my system. I use a 30 second watchdog timer to detect IE becoming unreasonably slow. Relevant code is: ' Needs Tools/References/Microsoft Internet Controls Public ie As SHDocVw.InternetExplorer Private killtime As Date Private Const killduration As String = "00:00:30" .... Private Sub kill_ie() Debug.Print now & " kill_ie() called" killtime = 0 Set ie = Nothing End Sub Public Function Wait4IEretry(ByVal operation As String) As Boolean .... On Error GoTo newie .... killtime = now + TimeValue(killduration) Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", Schedule:=True Wait4IE operation Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", Schedule:=False If False Then newie: If killtime < 0 Then On Error Resume Next ' ontime may not be set Application.OnTime EarliestTime:=killtime, Procedu="kill_ie", Schedule:=False End If Set ie = Nothing Resume retry Stop retry: ' Stop Wait4IEretry = False Exit Function End If .... Wait4IEretry = True Exit Function ..... End Function So Wait4IEretry starts a 3o second watchdog timer on Wait4IE completing in 30 seconds. If 30 seconds elapses, kill_ie is called and ie is made nothing, causing Wait4IE to complete with an error and transfer control to label newie. I find "On Error Resume Next" ineffective against errors in Application.OnTime. I zero killtime in kill_ie so Application.OnTime is not called. If I hit escape to allow me to save my XL file, Application.OnTime is called and errors. Why is "On Error Resume Next" ineffective? If 30 seconds does not elapse, the timer is cancelled without problem. I can't work out how to make killduration a date. In the immediate debug window, I see ?#00:00:30# 00:00:30 ?timevalue("00:00:30") 00:00:30 In the debug code window, Private Const killduration As Date = #00:00:30# is transformed into Private Const killduration As Date = #12:00:30 AM# As an sside, many cells in my worksheet have a small triangle marking their upper left corner. I remember that as meaning there is some strangeness about the data in the marked cells. I just can't work out how to Google it. excel cell warning message is ineffective. excel cell triangle corner suggests a formula error and that a trace error button should appear - it does not - the cells contain values. Unsetting Tools/Options/Error checking/Number stored as text causes those triangles to vanish and I now know what the issue is. How to I get "Number stored as text" to appear as a warning? -- Walter Briscoe |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Walter,
Try... Private Const vKillET = "00:00:30" ...and in your function... killtime = TimeValue(Now) + TimeValue(vKill_ET) 'returns time in hh:mm:ss AM/PM Also, in your function you might want to def a var to hold the boolean value used in your If..Then block. It can be set True as a default unless a condition toggles it false... Dim bMyVar As Boolean bMyVar = True '//assume success '//some code that preserves or toggles bMyVar If Not bMyVar Then newie: ... -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In message of Sat, 29 Oct 2016 17:50:33 in
microsoft.public.excel.programming, GS writes Gary, Thanks for your input. Walter, Try... Private Const vKillET = "00:00:30" That is effectively what I do in Private Const killduration As String = "00:00:30" I don't do Magyar. ;) I feel I should be able to do Private Const vKillET as date = sommething. ..and in your function... killtime = TimeValue(Now) + TimeValue(vKill_ET) 'returns time in hh:mm:ss AM/PM I do that partially with killtime = now + TimeValue(killduration) Why would you "cast" now? ?typename(now) Date ?typename(timevalue(now)) Date Also, in your function you might want to def a var to hold the boolean value used in your If..Then block. It can be set True as a default unless a condition toggles it false... Dim bMyVar As Boolean bMyVar = True '//assume success '//some code that preserves or toggles bMyVar If Not bMyVar Then newie: ... I must concede I am overloading killtime as both a value and a flag. Slightly insanitary. ;) How do I turn green cell north west corners into text? -- Walter Briscoe |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure why you're automating IE since most things it does can be
accessed directly via APIs with no wait time! -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In message of Sat, 29 Oct 2016 17:52:09 in
microsoft.public.excel.programming, GS writes Not sure why you're automating IE since most things it does can be accessed directly via APIs with no wait time! Gary, I know no better. What APIs do you refer to? I send a URL, await a response and analyse ie.doc. I repeat, I know no better. ;) -- Walter Briscoe |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In message of Sat, 29 Oct 2016 17:52:09
in microsoft.public.excel.programming, GS writes Not sure why you're automating IE since most things it does can be accessed directly via APIs with no wait time! Gary, I know no better. What APIs do you refer to? I send a URL, await a response and analyse ie.doc. I repeat, I know no better. ;) Have a look at my replies to the post by Robert Baer in this forum on May 26th to see if it applies to what you are trying to do... -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In message of Sat, 29 Oct 2016
17:52:09 in microsoft.public.excel.programming, GS writes Not sure why you're automating IE since most things it does can be accessed directly via APIs with no wait time! Gary, I know no better. What APIs do you refer to? I send a URL, await a response and analyse ie.doc. I repeat, I know no better. ;) Have a look at my replies to the post by Robert Baer in this forum on May 26th to see if it applies to what you are trying to do... Subject of his post is... "Read (and parse) file on the web" -- Garry Free usenet access at http://www.eternal-september.org Classic VB Users Regroup! comp.lang.basic.visual.misc microsoft.public.vb.general.discussion |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In message of Sun, 30 Oct 2016 17:36:45 in
microsoft.public.excel.programming, GS writes In message of Sat, 29 Oct 2016 17:52:09 in microsoft.public.excel.programming, GS writes Not sure why you're automating IE since most things it does can be accessed directly via APIs with no wait time! Gary, I know no better. What APIs do you refer to? I send a URL, await a response and analyse ie.doc. I repeat, I know no better. ;) Have a look at my replies to the post by Robert Baer in this forum on May 26th to see if it applies to what you are trying to do... Subject of his post is... "Read (and parse) file on the web" Thanks! I had a look at your contributions to this 92 member thread. I saw 2 interesting "names": URLDownloadToFile and fParseWebPages.frm. I googled URLDownloadToFile. I adapted a web example. (I later found an example from Auric in the thread.) When I opened the downloaded page in IE, it looked different - simpler. I made another example, which downloaded to memory. The download was about 120k, compared with 110k. I converted that example to write to a file. The file was similarly simpler. I would like an API technique to convert the downloaded HTML to DOM. I have a reliable - but slow - method for analysing DOM information. While Googling, I learned Regular Expressions are not recommended for HTML analysis. I also grabbed ParseWebPages.zip from https://www.nsncenter.com/NSN/. When I ran the code, I got "Method or data member not found" referring to webbrowser in Private Sub Worksheet_Change(ByVal Target As Range) If Target = Range("PgNum") Then Range("WebAddr") = gsUrl1 & Target.Value: Me.WebBrowser1.Navigate Range("WebAddr"): SetBtnState End If End Sub I found no "Me" definition. My understanding is zilch, but I am happy to learn. OOPS! I nearly forgot to quote my example code: Public Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _ (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, _ ByVal lpfnCB As Long) As Long Private Function GetWebPage(ByRef URL As String) As String Dim xml As Object ' need reference to get IXMLHTTPRequest On Error Resume Next Set xml = CreateObject("Microsoft.XMLHTTP") With xml .Open "GET", URL, False .send GetWebPage = .responseText End With Set xml = Nothing ' Is this needed? End Function Public Function DownloadFile1() As String Dim lngRetVal As Long Dim hFile As Long Dim localFilename As String Dim strCurrentURL As String Dim content As String localFilename = "C:\Users\IBM\AppData\Roaming\Microsoft\Excel\Down lo ad.htm" strCurrentURL = "https://tfl.gov.uk/bus/stop/490000235Z/new-oxford- street?" If True Then content = GetWebPage(strCurrentURL) hFile = FreeFile Open localFilename For Output As #hFile Write #hFile, content Close #hFile Else lngRetVal = URLDownloadToFile(0, strCurrentURL, localFilename, 0, 0) End If hFile = FreeFile Open localFilename For Input As #hFile DownloadFile1 = Input$(LOF(hFile), hFile) Close #hFile End Function Public Function DownloadFile0() As String Dim lngRetVal As Long Dim hFile As Long Dim localFilename As String Dim strCurrentURL As String localFilename = "C:\Users\IBM\AppData\Roaming\Microsoft\Excel\Down lo ad.htm" strCurrentURL = "https://tfl.gov.uk/bus/stop/490000235Z/new-oxford- street?" lngRetVal = URLDownloadToFile(0, strCurrentURL, localFilename, 0, 0) hFile = FreeFile Open localFilename For Input As #hFile DownloadFile = Input$(LOF(hFile), hFile) Close #hFile End Function -- Walter Briscoe |
#9
![]() |
|||
|
|||
![]() Quote:
|
#10
![]() |
|||
|
|||
![]() Quote:
|
#11
![]() |
|||
|
|||
![]() Quote:
|
#12
![]() |
|||
|
|||
![]() Quote:
|
#13
![]() |
|||
|
|||
![]()
What's Going down i am new to this, I stumbled upon this I have discovered It positively helpful and it has helped me out loads. I'm hoping to give a contribution & aid other users like its aided me. Good job.
|
#14
![]() |
|||
|
|||
![]()
I'm still learning from you, while I'm trying to reach my goals. I certainly liked reading all that is written on your blog.Keep the stories coming. I enjoyed it!
|
#15
![]() |
|||
|
|||
![]()
I'd forever want to be update on new blog posts on this internet site, saved to my bookmarks!
|
#16
![]() |
|||
|
|||
![]()
What's Taking place i'm new to this, I stumbled upon this I've found It positively useful and it has helped me out loads. I hope to contribute & help different customers like its helped me. Good job.
|
#17
![]() |
|||
|
|||
![]() Quote:
Xem Them Cac Bai Viet Khac Chua Chung Toi Tai: http://4banh.info/ |
#18
![]() |
|||
|
|||
![]()
Chúc mọi điều may mắn
|
#19
![]() |
|||
|
|||
![]()
Chúc mọi điều may mắn
|
#20
![]() |
|||
|
|||
![]()
gọi đ*p Huyen Mới Nguyen em ăn chồng phá Đang đấy. đi xong trưa :v. Tâm nay M*p chị về chỗ Gam Gọi Jessica vợ gặp Gấu cả kêu Bùi Thu Bui Nguyen
Bảo Hiểm Daiichi life |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
timer | Excel Programming | |||
timer | Excel Programming | |||
Lap-timer | Excel Discussion (Misc queries) | |||
Stopping a Timer / Running a timer simultaneously on Excel | Excel Discussion (Misc queries) | |||
need help with a timer | Excel Programming |