![]() Select Microsoft Internet Controls (you may find it helpful to type an M in first, to go down to the object libraries starting with M ): Tick the Microsoft Internet Controls object library reference. 'WebBrowser. First, in VBA create a reference: Choose the option shown from the VBA code editor (this example is for Excel). 'You can uncoment Next line To see form results As HTML ![]() If FormData "" Then FormData = FormData & "&"Įnd Sub 'sends URL encoded form data To the URL using IEĭim WebBrowser: Set WebBrowser = CreateObject( "InternetExplorer.Application") I am working on a VBA function to go to a webpage, find a single HTML element, and display its contents. 'and built string representaion of the form data 'sends form fields specified In Names/Values arrays To the URL Next VBA code simulates same submit of the form using IEĪrray( "FirstName", "LastName", "Email"), _Īrray( "Franta", "Vomacka", Post form data - begin Set IE CreateObject('InternetExplorer.Application') IE.Visible True IE.Navigate Website Login calls a sub this works so not important Dim objCollection As Variant Set objCollection IE.Document.getElementsByTagName('input') While C < objCollection. Next functions are samples of a POST request which sends POST form data. I am using VBA to interact with internet explorer. Internet explorer has a navigate method, which lets you send GET and POST request with data to any URL. ![]() Sometimes you have to send some forms to a web site without user interaction. For example, the following code can be used to open a web page in Internet Explorer: Sub OpenWebPage () Dim IE As New InternetExplorer IE.Navigate IE.Visible True End Sub This code will launch Internet Explorer and navigate to the specified web page. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |