PDA

View Full Version : Solved: Forms with hyperlinks



khalid79m
11-20-2009, 03:54 AM
I am currently working on making a form to pull back data in excel

I have a list of data , which can be anything from 100 rows to 40000 rows depending on the site I am working on , I need this form to allow the user to input the agent_ID and the click run, this will then populate the form with the first 5 calls for that agent.

the form must show in the following order

Unquie ID
Agent ID
Date
Time
Audit
Call Lenght
Call Link (hyperlink)

i have attached dummy data

khalid79m
11-20-2009, 04:29 AM
Private Sub Cmd_AgentPin_Search_Click()

If Sheets("Call_List").AutoFilterMode = True Then Sheets("Call_List").AutoFilterMode = False
Names.Add Name:="Filter_Area", RefersToR1C1:="=Call_List!R1C1:R65536C10"

With Range("Filter_Area").Resize(, 10)
.AutoFilter Field:=4, Criteria1:=Me.txt_AgentPin.Value
End With

Sheets("Data").Cells.ClearContents

Sheets("Call_List").Range("A1").CurrentRegion.Copy
Sheets("Data").Select
Range("a1").Select
ActiveSheet.Paste

Me.txt_Call1_Link.Value = ThisWorkbook.Sheets("Data").Range("I2").Value
Me.txt_Call2_Link.Value = ThisWorkbook.Sheets("Data").Range("I3").Value
End Sub
Private Sub Cmd_Call1_Play_Click()
Link = Me.txt_Call1_Link.Value
'On Error GoTo NoCanDo
ActiveWorkbook.FollowHyperlink Address:=Link, NewWindow:=True
Unload Me
'Exit Sub
'NoCanDo:
'MsgBox "Cannot open " & Link
End Sub
Private Sub Cmd_Call2_Play_Click()
Link = Me.txt_Call2_Link.Value
'On Error GoTo NoCanDo
ActiveWorkbook.FollowHyperlink Address:=Link, NewWindow:=True
Unload Me
'Exit Sub
'NoCanDo:
'MsgBox "Cannot open " & Link

End Sub


this code works fine until Private Sub Cmd_Call1_Play_Click or Private Sub Cmd_Call2_Play_Click. When I click the play button, it closes the user form and opens the link, i need the user form to always stay visible.

Can anyone help

tpoynton
11-20-2009, 07:11 AM
Unload Me closes the userform

khalid79m
11-20-2009, 08:03 AM
thanks