ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automate Excel URL Web Query (https://www.excelbanter.com/excel-programming/409148-automate-excel-url-web-query.html)

Zedox

Automate Excel URL Web Query
 
Synopsis:
I made this winforms application that automates a webpage from data the user
inputs. The webpage collects data and puts it into a database (it's a tab
delimited format). All I have to do is make a URL web query so that the
information is automatically inserted into the Excel file when the user opens
the excel file and click refresh.

What I want:
For the user to open the Excel File and press "Refresh" to get the
information from the webpage.

Question:
How do I set an Excel Object's URL Web Query?

What I know how to do:
Create an Excel Object, Workbook, and Worksheet.

Language of Choice:
C#

Thank you in advance. If I am not clear in what I want to do, please tell me
so I can elaborate.

SCrowley

Automate Excel URL Web Query
 
Zedox,

I don't speak C# but I am learning Excel and VBA.

I hope something in this code answers your question:

MSExcel 2007

Sub WebQuery()
'
' WebQuery Macro
'

'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.google.com/ig?hl=en", Destination:=Range("$F$1"))
.Name = "ig?hl=en"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
--
Thank you,

scrowley(AT)littleonline.com


"Zedox" wrote:

Synopsis:
I made this winforms application that automates a webpage from data the user
inputs. The webpage collects data and puts it into a database (it's a tab
delimited format). All I have to do is make a URL web query so that the
information is automatically inserted into the Excel file when the user opens
the excel file and click refresh.

What I want:
For the user to open the Excel File and press "Refresh" to get the
information from the webpage.

Question:
How do I set an Excel Object's URL Web Query?

What I know how to do:
Create an Excel Object, Workbook, and Worksheet.

Language of Choice:
C#

Thank you in advance. If I am not clear in what I want to do, please tell me
so I can elaborate.



All times are GMT +1. The time now is 03:13 AM.

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