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:
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?
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?