新建空白窗体,然后粘帖下面代码:
1 Option Explicit 2 Public WithEvents br As VBControlExtender 3 4 Private Sub br_ObjectEvent(Info As EventInfo) 5 If Info.Name = "NewWindow2" Then 6 ‘Dim fm As New Form1 7 ‘fm.Show 8 ‘Info.EventParameters(0) = br.object ‘根据需要可实现在自己的新开窗口打开弹出窗口 9 Info.EventParameters(1) = True ‘拦截弹出窗口 10 End If 11 End Sub 12 13 Private Sub Form_Click() 14 br.object.Navigate "http://www.baidu.com/" 15 End Sub 16 17 Private Sub Form_Load() 18 On Error Resume Next 19 If Licenses.Count = 0 Then Licenses.Add "Shell.Explorer.2", "Shell.Explorer.2" 20 Set br = Me.Controls.Add("Shell.Explorer.2", "br") 21 ‘br.Width = 150 * Screen.TwipsPerPixelX 22 ‘br.Height = 50 * Screen.TwipsPerPixelY 23 br.Visible = True 24 End Sub
时间: 2024-10-11 05:47:08