LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Error: Method 'open' of object 'IXMLHTTPRequest' failed

Works for me - using a slightly different version (MSXML2.XMLHTTP26)
since I don't have your version

What is the value of strUrl when you get the error? The url must have
the protocol as part of the address (ie. you need to have http://www.blahblah.com
and not just www.blahblah.com)

Tim



On Jan 23, 1:39*pm, Marvin wrote:
Hello all,

I'm trying to run the following macro but I get an error as given in
the subject line. Please help me to fix the error.

I'm trying to check if the hyperlinks in several cells of a column are
working or dead. Given below is not my code but I found it in the
internet and it suited what I'm trying to do.

Thanks,
Marvin.

Option Explicit

Sub CheckHyperlinks()

* * Dim oColumn As Range
* * Set oColumn = GetColumn() ' replace this with code to get the
relevant column

* * Dim oCell As Range
* * For Each oCell In oColumn.Cells

* * * * If oCell.Hyperlinks.Count 0 Then

* * * * * *Dim oHyperlink As Hyperlink
* * * * * * Set oHyperlink = oCell.Hyperlinks(1) ' I assume only 1
hyperlink per cell

* * * * * * Dim strResult As String
* * * * * * strResult = GetResult(oHyperlink.Address)

* * * * * * oCell.Offset(0, 1).Value = strResult

* * * * End If
*If Trim(oCell.Value) < "" Then
*oCell.Offset(0, 1).Value = GetResult(oCell.Value)
*End If

* * Next oCell

End Sub

Private Function GetResult(ByVal strUrl As String) As String

* * On Error GoTo ErrorHandler

* * Dim oHttp As New MSXML2.XMLHTTP30

* * oHttp.Open "HEAD", strUrl, False
* * oHttp.send

* * GetResult = oHttp.Status & " " & oHttp.statusText

* * Exit Function

ErrorHandler:
* * GetResult = "Error: " & Err.Description

End Function

Private Function GetColumn() As Range
* * Set GetColumn = ActiveWorkbook.Worksheets(1).Range("A:A")
End Function

Private Sub CommandButton1_Click()
Call CheckHyperlinks
End Sub


 
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
Method "Method 'Open' of object 'Workbooks' failed [email protected] Excel Programming 2 June 2nd 10 05:28 PM
More information on Method 'Open' of object 'Workbooks' failed ElectroVik Excel Programming 1 October 20th 06 06:18 AM
method 'open text' of object 'workbooks' failed tina Excel Programming 6 September 20th 05 11:18 AM
<Method 'Range' of object '_Global' failed error Ken Loomis Excel Programming 2 October 12th 04 01:29 PM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM


All times are GMT +1. The time now is 10:39 PM.

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"