0

I am working on a project that requires a certain amount of interactivity between the excel user and a web server.

I know you can use the

    hyperlink.follow 

method to open a url within the default browser.

However what I would like to accomplish is to be able to open a url behind the scenes without the page opening in a browser.

Does anyone know how this can be accomplished.

the following constraints apply.

  1. We cannot assume the user has a particular browser installed, ie. chrome, for example, nor can we assume the user has a browser installed at all.
  2. We cannot assume the users all have the same os. Some may have win7, some may have win10. We just don't know.
  3. We can assume that the computer is connected to the internet and has an IP address, and that firewalls will not be an issue.
user3005775
  • 306
  • 1
  • 3
  • 14
  • 1
    Possible duplicate of [Sending http requests with VBA from Word](http://stackoverflow.com/questions/3119207/sending-http-requests-with-vba-from-word) – GSerg Mar 25 '16 at 14:12
  • What interactivity is required? The answer will be more specific, if you provide details. – omegastripes Mar 26 '16 at 07:27

1 Answers1

1

You can open (read the entire content) of the web page specified by its Url like shown in the following Excel VBA code snippet:

Option Explicit

'sample procedure to read entire url content
Sub ReadUrlDoc()
  'sample url address
  Const url As String = "http://www.examn8.com"
  Dim urlText As String

  With CreateObject("MSXML2.XMLHTTP")
    .Open "GET", url, False
    .Send
    'url content
    urlText = .ResponseText
  End With
End Sub

The solution does not open/depend on the web browser. Hope this may help.

Alexander Bell
  • 7,842
  • 3
  • 26
  • 42