Hi!
I must open some web pages and make some task.
So my macro goes to Word, copy an URL, goes to Internet Explorer, paste the URL, Enter .......... I would like inclure just after Enter an If command for abort the macro when the web page couldn't be open.
¿Does someone help me? ¡Thanks!
Opening web pages
Moderators: Dorian (MJT support), JRL
Check if webpage can be loaded using HTTPRequest
Try something like the following
[code]
Let>HTTP_TIMEOUT=10
//URL of webpage to check
Let>URL=http://www.myj3-33u345n-2k3.com
HTTPRequest>URL,,GET,,HTMLResponse
//Some DNS servers return a special error page if the URL
//is not found -- if this is the case checking for 404 Error
//will not work. On my connection this works just fine
If>HTMLResponse=404 Error connecting to host
MessageModal>This webpage will not load
Else
MessageModal>This webpage is fine
Endif
[/code]
[code]
Let>HTTP_TIMEOUT=10
//URL of webpage to check
Let>URL=http://www.myj3-33u345n-2k3.com
HTTPRequest>URL,,GET,,HTMLResponse
//Some DNS servers return a special error page if the URL
//is not found -- if this is the case checking for 404 Error
//will not work. On my connection this works just fine
If>HTMLResponse=404 Error connecting to host
MessageModal>This webpage will not load
Else
MessageModal>This webpage is fine
Endif
[/code]