Follow Hyperlink in Excel 2007

C

Chrideling

Hi

I wrote a short peace of code for Excel 2000 where I create a rather
long URL. The Follow Hyperlink function worked fine. But it fails in
Excel 2007 for some reason. It gives me Run time error '5', invalid
procedure call or argument. Any idea why?

Private Sub cmdCreateURL_Click()
Dim intParam As Integer
Dim strURL As String
Sheets("FormData").Activate
ActiveSheet.Cells(1, 1).Select
ActiveSheet.Range(Selection, Selection.End(xlDown)).Select
intParam = Selection.Rows.Count
strURL = ActiveSheet.Cells(1, 2)
For i = 1 To intParam - 1
If ActiveSheet.Cells(i, 3) = "x" Then
strURL = strURL & ActiveSheet.Cells(i, 1) & "=" & ActiveSheet.Cells(i,
2) & "&"
End If

Next
strURL = strURL & ActiveSheet.Cells(intParam, 1) & "=" &
ActiveSheet.Cells(intParam, 2)
ActiveWorkbook.FollowHyperlink Address:=strURL, NewWindow:=True
Sheets("Form").Range("URL").Value = strURL
Sheets("Form").Select
Selection.Range("g7").Select
End Sub
 
Top