ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Calling an application from excel (https://www.excelbanter.com/excel-worksheet-functions/187415-calling-application-excel.html)

SatyanarayanaS

Calling an application from excel
 
I want to know how a web application can be called and executed without a
browser being shown.
Scenario:
I want to call a defect tracking tool from an excel "cell" and I want to
generate a graph based upon the latest data available in the defect tracking
tool. Will excel facilitate this or should I relay on programming.

Bernie Deitrick

Calling an application from excel
 
Below is example code that pulls data from a website. A lot depends on the workings of the site -
whether it is ASP for example, or uses Flash... The example site has named textboxes for entry,
etc. Take a look at the code below, and the coding of the site.

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 = False
.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 = False
End With
IE.Quit
Dim myStr As String
myStr = ActiveSheet.Cells(1, "A").Value
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

End Sub



"SatyanarayanaS" wrote in message
...
I want to know how a web application can be called and executed without a
browser being shown.
Scenario:
I want to call a defect tracking tool from an excel "cell" and I want to
generate a graph based upon the latest data available in the defect tracking
tool. Will excel facilitate this or should I relay on programming.





All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com