Basic set up is I have a userform with a textbox & button. Put text in the box & click the button, It calls sub FNN_lookup(FNN). This sub have the "ieApp.Visible = False" line but internet explorer still ends up being visible. Any Ideas as to why? the sub has been tested without the userform and works as expected.
Any help greatly appreciated
Any help greatly appreciated
Code:
Sub CommandButton1_Click()
Dim FNN
FNN = FNN_Box.Value
Call FNN_lookup(FNN)
End Sub
Sub FNN_lookup(FNN)
Dim ieApp As InternetExplorerMedium
Dim ieDoc As Object
Dim ieTable As Object
Dim clip As DataObject
'create a new instance of ie
Set ieApp = New InternetExplorerMedium
'Change to true for debugging
ieApp.Visible = False
'go to google page, wait till ready then set required values, These have be changed slightly as site this is based for is internal only & this Sub works as expected just isnt hidden
ieApp.Navigate "[URL]https://www.google.com.au/search?hl=en-AU&source=hp&q=" & FNN[/URL]
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.ReadyState = READYSTATE_COMPLETE: DoEvents: Loop
'get the table based on the table’s id
Set ieDoc = ieApp.Document
Set ieTable = ieDoc.all.Item("gvTaskRes")
'copy the tables html to the clipboard and paste to teh sheet
If Not ieTable Is Nothing Then
Set clip = New DataObject
clip.SetText "" & ieTable.outerHTML & ""
clip.PutInClipboard
With Sheets("sheet1").Range("A1")
.PasteSpecial "Unicode Text"
End With
End If
'Close 'er up
ieApp.Quit
Set ieApp = Nothing
End Sub