Share via

Refesh webpage with excel VBA code

Anonymous
2015-05-13T12:55:48+00:00

Hi,

I'm using the code below to open webpage

Private Sub cmdLogIn_Click()

    Dim MyHTML_Element As IHTMLElement

    Dim Hompage As IHTMLElement

Dim MyURL As String

    On Error GoTo Err_Clear

    MyURL = "http://My5566:8080/ABAB/Portal"

    Set MyBrowser = New InternetExplorer

    MyBrowser.Silent = True

    MyBrowser.navigate MyURL

    MyBrowser.Visible = True

Err_Clear:

        If Err <> 0 Then

        Err.Clear

        Resume Next

 End If

End Sub

But after page loaded it display message as

NAVIGATION TO THE WEBPAGE WAS CANCELED 

WHAT YOU CAN TRY:

Refresh the page

So if I click on the refresh then it load correctly! How can refresh this without click on refresh button on the webpage?

Thanks,

Tony

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2015-05-13T15:31:11+00:00

    I would first try to use the IE as usual, means visible, etc. and check if the page loads.

    It is possible that some security settings "works" in the background and prevent that the page can be loaded "behind the scenes".

    Andreas.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2015-05-13T13:48:10+00:00

    Yes, I did tried MyBrowser.Refresh but the result still same. Do you have any other suggestion?

    Was this answer helpful?

    0 comments No comments
  3. Andreas Killer 144.1K Reputation points Volunteer Moderator
    2015-05-13T13:10:47+00:00

    Hi Tony,

    try MyBrowser.Refresh but I don't believe that it solves the issue.

    Andreas.

    Was this answer helpful?

    0 comments No comments