我很努力,因为几个月来完成这件事,如何编写VBA来打开新的会话我有许多登录,我需要同时使用自动打开它们的应用程序的Internet Explorer,我已经使用
set ie=new InternetExplorer
但它开启了旧会话中,即,我想对于每一个登录,请帮我开新的会话,我GOOGLE了很多关于它,但最终有任何解决方案。 这是我的代码
Function GetIE() As InternetExplorer
Dim WScript
Dim objShellWindows
Set objShell = CreateObject("Shell.Application")
Set objShellWindows = objShell.Windows
Set WScript = CreateObject("WScript.Shell")
Dim ieStarted
ieStarted = False
Dim ieError
ieError = False
Dim seconds
seconds = 0
While (Not ieStarted) And (Not ieError) And (seconds < 30)
If (Not objShellWindows Is Nothing) Then
Dim objIE As InternetExplorer
Dim IE
For Each objIE In objShellWindows
If (Not objIE Is Nothing) Then
If IsObject(objIE.Document) Then
Set IE = objIE.Document
If VarType(IE) = 8 Then
If IE.Title = EmptyTitle Then
If Err.Number = 0 Then
IE.Write LoadingMessage
objIE.navigate Sheet1.Login.Text
ieStarted = True
Set GetIE = objIE
Else
MsgBox ErrorMessage
Err.Clear
ieError = True
Exit For
End If
End If
End If
End If
End If
Set IE = Nothing
Set objIE = Nothing
Next
End If
Application.Wait Now + TimeValue("00:00:1")
seconds = seconds + 1
Wend
Set objShellWindows = Nothing
Set objShell = Nothing
End Function
与此代码即时通讯能够打开它已经打开请帮助的浏览器,但可悲的是我的网页是在Outlook中打开