N
N
Nadim Zakirov2020-12-13 22:24:08
Macros
Nadim Zakirov, 2020-12-13 22:24:08

Can Excel macros load information into a document from the web?

Tell me, please, how wide are the possibilities of BUILT-IN macros in Excel? Can a macro download some arbitrary text from my server and insert it into a cell?

Goal: so that when the table is opened, the data in the cells is automatically updated, pulling up from my site. This is necessary to update the balance of goods on the fly.

I am not yet interested in the technical implementation, I just ask you to answer - is it feasible in principle or I want the impossible.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Boev, 2020-12-14
@zkrvndm

Like this:

Private Function getData(strUrl As String) As String
   Dim http As Object

   On Error Resume Next
   Set http = CreateObject("MSXML2.XMLHTTP")
   If Err.Number <> 0 Then
     Set http = CreateObject("MSXML.XMLHTTPRequest")
   End If

   On Error GoTo 0
   If http Is Nothing Then
     getData = ""
     Exit Function
   End If

   http.Open "GET", strUrl, False
   http.Send

   getData = http.responseText
   Set http = Nothing
End Function

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question