Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FollowHyperlink Intermittently Causes Excel to Stop Responding

Status
Not open for further replies.

pnjones

Technical User
Dec 1, 2000
25
0
0
US
I have created an Excel VBA application which included links to Google Apps (Calendar, Contacts and Maps). Most of the time these links work fine, but intermittently one will cause Excel to stop responding, and I am forced to terminate the task with Task Manager. I included error traps that display a message box, and the error message does appear, but only briefly after the task has been terminated. Here is an example:

Code:
Sub OpenCalendar()
' Open Google Calendar
Dim GoogleCalendarURL As String
    GoogleCalendarURL = "[URL unfurl="true"]https://www.google.com/calendar/render"[/URL]
LinkToCalendar:
' Activate error trap then attempt link
    On Error GoTo LinkCalendarError
    ActiveWorkbook.FollowHyperlink Address:=GoogleCalendarURL, NewWindow:=True
' If link OK, reset error trap and exit
    On Error GoTo 0
    Exit Sub
LinkCalendarError:
' Reset error trap then display error prompt
    On Error GoTo 0
    UserMsg = "An unknown error has occurred attempting to link to the address:" & Chr(13) & Chr(13) _
            & GoogleCalendarURL & Chr(13) & Chr(13) _
            & "Would you like to retry?"
    UserPrompt = MsgBox(UserMsg, vbExclamation + vbRetryCancel, "Browser Link Error")
' If user clicks Retry, return to link
    If UserPrompt = vbRetry Then
        GoTo LinkToCalendar
    End If
End Sub

I have tested this with Windows XP, Windows 7, Excel 2002, 2007 and 2010, using Chrome, Firefox, and IE but am able to create the same failure intermittently. Is anyone aware of a solution to this problem?
 
What does Error$ return when you enter the error trap?
 
I don't know the error code but good idea. I have added Error(Err) to the trap display.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top