+ Reply to Thread
Results 1 to 5 of 5

VBA to return Web-based XML document contents as a string.

  1. #1
    Registered User
    Join Date
    07-25-2019
    Location
    Salt Lake City, UT
    MS-Off Ver
    2016 32 bit
    Posts
    21

    VBA to return Web-based XML document contents as a string.

    I have been working my entire Saturday at this. Mostly, I tried to create xml Schema maps and all kinds of stuff. I don't think it needs to be that complex. So, i took it back to the basics.

    In VBA, I used cell contents to help formulate a URL. The URL opens in IE, and the page that loads is a simple, tine XML document. I need to return the contents of that page (which is an xml document) as a string to VBA.

    Otherwise, I need an easy, comprehendible way to do a Web call to ask for the data and return it as a string.

    Here is what I have so
    HTML Code: 

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA to return Web-based XML document contents as a string.

    I can go to long ways of explaining it but since you already have vba code, read up on this one and you'll gte the idea.
    Just remove all non essential html tags from the retrieved cod
    https://www.encodedna.com/excel/extr...-using-vba.htm
    Happy coding
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    07-25-2019
    Location
    Salt Lake City, UT
    MS-Off Ver
    2016 32 bit
    Posts
    21

    Re: VBA to return Web-based XML document contents as a string.

    I might not be advanced enough to use that code. VBA doesn't recognize terms like "HTMLDocument". I might be missing something. I tried dimming it as an object instead. But I still encounter issues when I get to the part where it's supposed to retrieve the contents of the file.

    I think this is basically a Web call. I submit the URL, and the page that loads is an XML document containing the results. I don't care if it has tags, etc. I just want to be able to return all of the resulting plain text to a cell.
    Last edited by joeyslaptop; 09-13-2021 at 11:45 AM.

  4. #4
    Registered User
    Join Date
    07-25-2019
    Location
    Salt Lake City, UT
    MS-Off Ver
    2016 32 bit
    Posts
    21

    Re: VBA to return Web-based XML document contents as a string.

    Update: I didn't realize you have to install/activate additional Libraries in order for it to recognize the terminology.

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: VBA to return Web-based XML document contents as a string.

    Yep, many functions and references are library dependant
    For each application there are separate libraries which ned to be referenced for VBA code to work properly
    I was away for the past days, how have you fared so far?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 07-17-2020, 01:15 PM
  2. [SOLVED] Extract data based on text string contents + organizing results
    By macrorookie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-26-2020, 08:52 AM
  3. Replies: 5
    Last Post: 06-28-2018, 11:11 AM
  4. Replies: 1
    Last Post: 06-19-2015, 01:29 AM
  5. Return contents of cells that contain a character string.
    By Bhodi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-16-2015, 02:06 PM
  6. Return pictures based on cell contents
    By okctaxaccountant in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2014, 09:52 PM
  7. [SOLVED] IF range of cells contains string of text, return contents of cell where string is found
    By nobodyukno in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-03-2013, 09:56 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1