Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2007, 05:33 AM
Registered User
 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Import data from web service

Hi,

I am trying to generate a report for which the data needs to imported by calling a web service. Is it possible to do that from a VBA? If not what are the alternatives for me to do it?

Thanks in advance.
Baris Istap.

 
Old November 26th, 2007, 01:12 PM
Friend of Wrox
 
Join Date: Feb 2007
Posts: 163
Thanks: 0
Thanked 2 Times in 2 Posts
Default

It is possible to use an IE object in Excel to open the page.

First do the following so the appropriate resource is available:
1) From the VBA window click Tools > References
2) Scroll down and check Microsoft Internet Controls
3) Click OK.

After that try this function to get the body:
---------------------------------------------------
Private Function RetrieveSite(sHTTP As String) As String

'Opens file at sHTTP and returns the text part of the body
  Dim ieBrowser As InternetExplorer
  Set ieBrowser = CreateObject("InternetExplorer.Application")
  ieBrowser.Navigate sHTTP
  ieBrowser.Visible = True 'set = False if you'd rather not see it open
  Do While ieBrowser.ReadyState <> READYSTATE_COMPLETE
    DoEvents
  Loop
  RetrieveSite = ieBrowser.Document.Body.innerTEXT
  ieBrowser.Quit

End Function
---------------------------------------------------

There is more than this available but this should get you pointed in the right direction.

I hope this helped.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 08:38 AM
Error to Add Web Reference from a Web service jdjbarrios ASP.NET 2.0 Professional 0 July 18th, 2006 02:58 PM
Extract data from the XML result of a web service s.hendy ASP.NET 1.0 and 1.1 Basics 0 March 16th, 2006 12:27 PM
Service Oriented Web Service aldwinenriquez .NET Web Services 2 September 15th, 2005 03:25 AM
import data from web form Mitch Access VBA 8 September 4th, 2003 04:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.