createDocumentFromURL

G

Guest

Dear Sir,

I am using a macro to retreive multiple (>100) pages from the web using
createDocumentFromUrl function. I receive the following IE message:

This page has an unspecified potential security flaw. Would you like to
continue?

Is there a way to supress this message.

Note that retreive the page manually with IE, I do not receive this message.

Regards

JC
 
G

Guest

Dear Tim,

seems like your the only person that has responded to my multiple requests
on this issue. I have tried adjusting the ie settings, but did not manage to
solve the issue - sort of random changes to the ie options (which I am loathe
to take), I am stuck.

Any other ideas?

Thanks

JC
 
T

Tim Williams

Maybe you could show your exact code - or at least the part which is
erroring out.
I noticed that the page does have a pop-up which launches on load -
don't know if that's the issue.

You could always try using XMLHTTP to grab the source, save it locally
and then open it from there.
Or just open the page directly in Excel.

Tim.
 
G

Guest

Here is the code, will try the xmlhttp stuff as suggested. Again, thanks for
the ongoing assistance.

JC

Function TradingRoomGetQuoteData(ByVal sWS As String) As Boolean
Dim oMSHTML As MSHTML.HTMLDocument
Dim oHTMLDoc As MSHTML.HTMLDocument
Dim oDataTable As MSHTML.HTMLTable
Dim oWebTables As Object

Dim oWB As Workbook
Dim oWSCompanyList As Worksheet

Dim sQuoteQuery As String
Dim sTableData As String
Dim sASXCodes As String
Dim sURL As String

Dim iLastCompanyRow As Integer
Dim iCompanyRow As Integer
Dim iTableRow As Integer
Dim iTableCell As Integer

Dim bFoundLast As Boolean, bFoundYield As Boolean, bFoundCap As Boolean

Set oMSHTML = New MSHTML.HTMLDocument

Set oWB = ActiveWorkbook
Set oWSCompanyList = oWB.Worksheets(sWS)

sURL =
"http://tradingroom.com.au/apps/qt/quote.ac?section=quotedetail&sy=tpl&type=delayedquote&code="

iLastCompanyRow = oWSCompanyList.Cells.SpecialCells(xlLastCell).Row - 1

iCompanyRow = ASXLIST_OFFSET

Do While iCompanyRow <= iLastCompanyRow

sASXCodes = oWSCompanyList.Cells(iCompanyRow, 2).Value
'sQuoteQuery = sURL & "BHP"
sQuoteQuery = sURL & sASXCodes
Set oHTMLDoc = oMSHTML.createDocumentFromUrl(sQuoteQuery,
vbNullString)

While oHTMLDoc.readyState <> "complete"
DoEvents
Wend
'other code here deleted for simplicity
iCompanyRow = iCompanyRow + 1
Loop

End Function
 
T

Tim Williams

Try replacing this:
Set oHTMLDoc = oMSHTML.createDocumentFromUrl(sQuoteQuery, vbNullString)

with something like:
.....
dim oWB as workbook
....
set oWB=workbooks.open sQuoteQuery
'you should then be able to extract your information from the new workbook
oWB.close

Tim.
 
G

Guest

the xmlhttp suggestion works well - I will stick that as it is cleaner for
what I am trying to do. With regard to suggestion below (also tried
successfully): surely it can't be that easy...

thanks for the help
 
Joined
Sep 8, 2008
Messages
3
Reaction score
0
Fix found!!!

It was very hard to solve the issue similar as Jack Clift was reporting. therefor I post it here to help guys googling around like me.

On XP it was sufficient to add the sites you wanted to crawl as trusted sites, but for Vista that doensn't work either.

I solved by setting the editMode before creating the document. This seems to supress execution of active content (scripts etc), and therefor more safe:

Code:
 Set objMSHTML = New MSHTML.HTMLDocument
  objMSHTML.DesignMode = "on" 'surpress security warning IE "this page has an unspecified potential security flaw" in next line
  Set objDoc = objMSHTML.createDocumentFromUrl(strUrl, vbNullString)

Happy coding
ErKr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top