Hi there, I have the below macro to open webpages and automatically log in for a number of sites however i am struggling to work out how to get the pages to open in a new IE tab rather than in a new window, my browser is set to open links from other programmes in a new tab which works when I click on a hyperlink on my workbook but I cannot work out how to alter the macro to do the same as what the hyperlinks do.
Many thanks in advance
Public Sub Google()
Const strURL_c As String = "http://mail.google.com"
Const strUsr_c As String = ""
Const strPwd_c As String = ""
Dim objIE As SHDocVw.InternetExplorer
Dim ieDoc As MSHTML.HTMLDocument
Dim tbxPwdFld As MSHTML.HTMLInputElement
Dim tbxUsrFld As MSHTML.HTMLInputElement
Dim btnSubmit As MSHTML.HTMLInputElement
On Error GoTo Err_Hnd
'Create Internet Explorer Object
Set objIE = New SHDocVw.InternetExplorer
'Navigate the URL
objIE.navigate strURL_c
'Wait for page to load
Do Until objIE.readyState = READYSTATE_COMPLETE: Loop
'Get document object
Set ieDoc = objIE.document
'Get username/password fields and submit button.
Set tbxPwdFld = ieDoc.all.Item("Passwd")
Set tbxUsrFld = ieDoc.all.Item("Email")
Set btnSubmit = ieDoc.all.Item("signIn")
'Fill Fields
tbxUsrFld.Value = Worksheets("Login Data").Range("C12").Value
tbxPwdFld.Value = Worksheets("Login Data").Range("D12").Value
'Click submit
btnSubmit.Click
'Wait for page to load
Do Until objIE.readyState = READYSTATE_COMPLETE: Loop
Err_Hnd: '(Fail gracefully)
objIE.Visible = True
End Sub
Many thanks in advance
Public Sub Google()
Const strURL_c As String = "http://mail.google.com"
Const strUsr_c As String = ""
Const strPwd_c As String = ""
Dim objIE As SHDocVw.InternetExplorer
Dim ieDoc As MSHTML.HTMLDocument
Dim tbxPwdFld As MSHTML.HTMLInputElement
Dim tbxUsrFld As MSHTML.HTMLInputElement
Dim btnSubmit As MSHTML.HTMLInputElement
On Error GoTo Err_Hnd
'Create Internet Explorer Object
Set objIE = New SHDocVw.InternetExplorer
'Navigate the URL
objIE.navigate strURL_c
'Wait for page to load
Do Until objIE.readyState = READYSTATE_COMPLETE: Loop
'Get document object
Set ieDoc = objIE.document
'Get username/password fields and submit button.
Set tbxPwdFld = ieDoc.all.Item("Passwd")
Set tbxUsrFld = ieDoc.all.Item("Email")
Set btnSubmit = ieDoc.all.Item("signIn")
'Fill Fields
tbxUsrFld.Value = Worksheets("Login Data").Range("C12").Value
tbxPwdFld.Value = Worksheets("Login Data").Range("D12").Value
'Click submit
btnSubmit.Click
'Wait for page to load
Do Until objIE.readyState = READYSTATE_COMPLETE: Loop
Err_Hnd: '(Fail gracefully)
objIE.Visible = True
End Sub