Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
   
  Private Sub Command1_Click()
  ShellExecute 0, "Open", "Http://www.CCTV.com", "", "", vbNormalFocus
  End Sub
    以上代码可以让VB运行时自动打开一个网页,想问下如果同时打开多个网页呢?

解决方案 »

  1.   

    Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long 
      
      Private Sub Command1_Click() 
      ShellExecute 0, "Open", "Http://www.CCTV.com", "", "", vbNormalFocus
     ShellExecute 0, "Open", "Http://www.hao123.com", "", "", vbNormalFocusEnd Sub 
      

  2.   

        Dim objExplorer As Object
        Dim i As Long    For i = 1 To 2
            
            Set objExplorer = CreateObject("InternetExplorer.Application")
            
            With objExplorer
                .Navigate "http://www.CSDN.net"
                .Visible = True
            End With
            
            Set objExplorer = Nothing
        
        Next i