Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reference to IE - but none found?
I have some code, I think developed for Excel 97 that requires a reference to
MS Internet Explorer. The problem is, I don't have a library for IE. Has it been changed? Can I download it from somewhere? OR, better still, can someone update the following code for XP? Sub FindImages(sURL As String) Dim oDoc As New MSHTML.HTMLDocument Dim IE As New InternetExplorer Dim i As Integer IE.navigate sURL Do While IE.readyState < READYSTATE_COMPLETE Loop Set oDoc = IE.Document For i = 1 To oDoc.images.Length If oDoc.images(i - 1).src Like "http://ichart.yahoo.com/*" Then saveImg oDoc.images(i - 1).src, ThisWorkbook.Path & "\temp.png" End If Next i Set oDoc = Nothing Set IE = Nothing End Sub Thanks in advance. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reference to IE - but none found?
Hi quartz,
The reference you need for the InternetExplorer object is "Microsoft Internet Controls". Or you could use Late Binding by declaring both object variables As Object and using CreateObject instead of the New keyword. If you decide to use Late Binding, you'll also have to replace the constant READYSTATE_COMPLETE with its literal value, which is 4. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] quartz wrote: I have some code, I think developed for Excel 97 that requires a reference to MS Internet Explorer. The problem is, I don't have a library for IE. Has it been changed? Can I download it from somewhere? OR, better still, can someone update the following code for XP? Sub FindImages(sURL As String) Dim oDoc As New MSHTML.HTMLDocument Dim IE As New InternetExplorer Dim i As Integer IE.navigate sURL Do While IE.readyState < READYSTATE_COMPLETE Loop Set oDoc = IE.Document For i = 1 To oDoc.images.Length If oDoc.images(i - 1).src Like "http://ichart.yahoo.com/*" Then saveImg oDoc.images(i - 1).src, ThisWorkbook.Path & "\temp.png" End If Next i Set oDoc = Nothing Set IE = Nothing End Sub Thanks in advance. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reference to IE - but none found?
Whoa! Thanks Jake.
This sub calls another as follows: Sub saveImg(sURL As String, sPath As String) Dim oXHTTP As New MSXML2.XMLHTTP Dim oStream As New ADODB.Stream Dim oFSO As New Scripting.FileSystemObject oXHTTP.Open "GET", sURL, False oXHTTP.send oStream.Type = adTypeBinary oStream.Open oStream.Write oXHTTP.responseBody oStream.SaveToFile sPath, adSaveCreateOverWrite oStream.Close Set oXHTTP = Nothing Set oStream = Nothing Set oFSO = Nothing End Sub Can you tell me where I could find illustrative examples on how to code using "Streams" and IE? Again thanks for the assistance. "Jake Marx" wrote: Hi quartz, The reference you need for the InternetExplorer object is "Microsoft Internet Controls". Or you could use Late Binding by declaring both object variables As Object and using CreateObject instead of the New keyword. If you decide to use Late Binding, you'll also have to replace the constant READYSTATE_COMPLETE with its literal value, which is 4. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] quartz wrote: I have some code, I think developed for Excel 97 that requires a reference to MS Internet Explorer. The problem is, I don't have a library for IE. Has it been changed? Can I download it from somewhere? OR, better still, can someone update the following code for XP? Sub FindImages(sURL As String) Dim oDoc As New MSHTML.HTMLDocument Dim IE As New InternetExplorer Dim i As Integer IE.navigate sURL Do While IE.readyState < READYSTATE_COMPLETE Loop Set oDoc = IE.Document For i = 1 To oDoc.images.Length If oDoc.images(i - 1).src Like "http://ichart.yahoo.com/*" Then saveImg oDoc.images(i - 1).src, ThisWorkbook.Path & "\temp.png" End If Next i Set oDoc = Nothing Set IE = Nothing End Sub Thanks in advance. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reference to IE - but none found?
Hi quartz,
I don't know of any resources offhand (besides the MSDN/MS sites). My understanding of XMLHTTP code came mainly from results of Google searches. It's a popular technology for the ASP folks, so you may want to look around some ASP sites for more examples. Here's an example I posted back in June 2002 that does a generic file copy over HTTP, if it helps any: http://groups-beta.google.com/group/...93dbf506ee96fd -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] quartz wrote: Whoa! Thanks Jake. This sub calls another as follows: Sub saveImg(sURL As String, sPath As String) Dim oXHTTP As New MSXML2.XMLHTTP Dim oStream As New ADODB.Stream Dim oFSO As New Scripting.FileSystemObject oXHTTP.Open "GET", sURL, False oXHTTP.send oStream.Type = adTypeBinary oStream.Open oStream.Write oXHTTP.responseBody oStream.SaveToFile sPath, adSaveCreateOverWrite oStream.Close Set oXHTTP = Nothing Set oStream = Nothing Set oFSO = Nothing End Sub Can you tell me where I could find illustrative examples on how to code using "Streams" and IE? Again thanks for the assistance. "Jake Marx" wrote: Hi quartz, The reference you need for the InternetExplorer object is "Microsoft Internet Controls". Or you could use Late Binding by declaring both object variables As Object and using CreateObject instead of the New keyword. If you decide to use Late Binding, you'll also have to replace the constant READYSTATE_COMPLETE with its literal value, which is 4. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] quartz wrote: I have some code, I think developed for Excel 97 that requires a reference to MS Internet Explorer. The problem is, I don't have a library for IE. Has it been changed? Can I download it from somewhere? OR, better still, can someone update the following code for XP? Sub FindImages(sURL As String) Dim oDoc As New MSHTML.HTMLDocument Dim IE As New InternetExplorer Dim i As Integer IE.navigate sURL Do While IE.readyState < READYSTATE_COMPLETE Loop Set oDoc = IE.Document For i = 1 To oDoc.images.Length If oDoc.images(i - 1).src Like "http://ichart.yahoo.com/*" Then saveImg oDoc.images(i - 1).src, ThisWorkbook.Path & "\temp.png" End If Next i Set oDoc = Nothing Set IE = Nothing End Sub Thanks in advance. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Reference to IE - but none found?
Okay. Thanks again.
"Jake Marx" wrote: Hi quartz, I don't know of any resources offhand (besides the MSDN/MS sites). My understanding of XMLHTTP code came mainly from results of Google searches. It's a popular technology for the ASP folks, so you may want to look around some ASP sites for more examples. Here's an example I posted back in June 2002 that does a generic file copy over HTTP, if it helps any: http://groups-beta.google.com/group/...93dbf506ee96fd -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] quartz wrote: Whoa! Thanks Jake. This sub calls another as follows: Sub saveImg(sURL As String, sPath As String) Dim oXHTTP As New MSXML2.XMLHTTP Dim oStream As New ADODB.Stream Dim oFSO As New Scripting.FileSystemObject oXHTTP.Open "GET", sURL, False oXHTTP.send oStream.Type = adTypeBinary oStream.Open oStream.Write oXHTTP.responseBody oStream.SaveToFile sPath, adSaveCreateOverWrite oStream.Close Set oXHTTP = Nothing Set oStream = Nothing Set oFSO = Nothing End Sub Can you tell me where I could find illustrative examples on how to code using "Streams" and IE? Again thanks for the assistance. "Jake Marx" wrote: Hi quartz, The reference you need for the InternetExplorer object is "Microsoft Internet Controls". Or you could use Late Binding by declaring both object variables As Object and using CreateObject instead of the New keyword. If you decide to use Late Binding, you'll also have to replace the constant READYSTATE_COMPLETE with its literal value, which is 4. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] quartz wrote: I have some code, I think developed for Excel 97 that requires a reference to MS Internet Explorer. The problem is, I don't have a library for IE. Has it been changed? Can I download it from somewhere? OR, better still, can someone update the following code for XP? Sub FindImages(sURL As String) Dim oDoc As New MSHTML.HTMLDocument Dim IE As New InternetExplorer Dim i As Integer IE.navigate sURL Do While IE.readyState < READYSTATE_COMPLETE Loop Set oDoc = IE.Document For i = 1 To oDoc.images.Length If oDoc.images(i - 1).src Like "http://ichart.yahoo.com/*" Then saveImg oDoc.images(i - 1).src, ThisWorkbook.Path & "\temp.png" End If Next i Set oDoc = Nothing Set IE = Nothing End Sub Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Return worksheet name containing value found in 3D reference funct | Excel Worksheet Functions | |||
Reference Cell if Found in a IF function | Excel Worksheet Functions | |||
IF NOT FOUND | Excel Worksheet Functions | |||
I found reference to info that I need on Excel-how do I acess the | Charts and Charting in Excel | |||
How do I reference external data from a file, file name found in . | Excel Discussion (Misc queries) |