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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top