filout web page form
Hello
Is there a way to use a spreadsheet to automatically add data to a form on a web page? tia Basil |
filout web page form
Basil,
Yes, if the form fields are named. See example code below. HTH, Bernie MS Excel MVP Sub GETTAF() Dim IE Dim IPF ' Prepare to open the web page Set IE = CreateObject("InternetExplorer.Application") With IE .Visible = True .Navigate "http://weather.noaa.gov/weather/shorttaf.shtml" ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop ' Make the desired selections on the web page and click the submitButton Set IPF = IE.Document.all.Item("CCCC") IPF.Value = "LEVC" Set IPF = IE.Document.all.Item("SUBMIT") IPF.Value = "submit" IPF.Click ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop End With Sheets("sheet1").Select ActiveSheet.Cells(1, "A").Value = IE.Document.body.innerText ' Close the internet explorer application With IE .Visible = True End With IE.Quit Dim myStr As String myStr = IE.Document.body.innerText myStr = Mid(myStr, InStr(1, myStr, "TAF"), Len(myStr)) myStr = Left(myStr, InStr(InStr(1, myStr, Chr(13)) + 1, myStr, Chr(13))) ActiveSheet.Cells(1, "A").Value = myStr ' Call PASTETAF End Sub "basil" wrote in message ... Hello Is there a way to use a spreadsheet to automatically add data to a form on a web page? tia Basil |
filout web page form
Thanks Bernie
I'll give this a try "Bernie Deitrick" <deitbe @ consumer dot org wrote in message ... Basil, Yes, if the form fields are named. See example code below. HTH, Bernie MS Excel MVP Sub GETTAF() Dim IE Dim IPF ' Prepare to open the web page Set IE = CreateObject("InternetExplorer.Application") With IE .Visible = True .Navigate "http://weather.noaa.gov/weather/shorttaf.shtml" ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop ' Make the desired selections on the web page and click the submitButton Set IPF = IE.Document.all.Item("CCCC") IPF.Value = "LEVC" Set IPF = IE.Document.all.Item("SUBMIT") IPF.Value = "submit" IPF.Click ' Loop until the page is fully loaded Do Until Not .Busy DoEvents Loop End With Sheets("sheet1").Select ActiveSheet.Cells(1, "A").Value = IE.Document.body.innerText ' Close the internet explorer application With IE .Visible = True End With IE.Quit Dim myStr As String myStr = IE.Document.body.innerText myStr = Mid(myStr, InStr(1, myStr, "TAF"), Len(myStr)) myStr = Left(myStr, InStr(InStr(1, myStr, Chr(13)) + 1, myStr, Chr(13))) ActiveSheet.Cells(1, "A").Value = myStr ' Call PASTETAF End Sub "basil" wrote in message ... Hello Is there a way to use a spreadsheet to automatically add data to a form on a web page? tia Basil |
All times are GMT +1. The time now is 12:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com