ieApp.Visible = False not working when in a sub called from a userform

Brendann

New Member
Joined
Apr 9, 2015
Messages
1
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

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
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,216,180
Messages
6,129,344
Members
449,506
Latest member
nomvula

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top