Thread: web query+vba
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mahesh Mahesh is offline
external usenet poster
 
Posts: 29
Default web query+vba

Hi i am a beginner of EXcel and VBA coding. Iam trying to access a site which
takes input from the user and displays the data. I have written the following
code but not able to pull the required data into excel. Can anyone please
help me on this.
Private Sub CommandButton2_Click()
Dim ie As Object
Dim objBK As Workbook
Set objBK = Workbooks.Add
With objBK.Worksheets(1)
Set ie = CreateObject("InternetExplorer.Application")

On Error GoTo errHandler
With ie
.navigate "http://data.bls.gov/cgi-bin/srgate"
Do While .busy: DoEvents: Loop
Do While .ReadyState < 4: DoEvents: Loop
With .document.forms(0)
.series_id.Value = " ECU11121I"
.Submit

End With
End With

End With

errHandler:
ie.Quit: Set ie = Nothing

End Sub