How to automate the login to a web request for loading data in Microsoft Excel 2007?

Is there anyone who can share knowledge on how to automate a web request in GayExcel 2007 by automatically starting a session?

My problem is that I need to manually enter the web request each time ...

+3
source share
3 answers

USE C # SOM INTERFACE for EXCEL THROUGH SEE ANY DATA IN EXCEL ...... click google with the following search keywords and u will get 100 results for it

using Excel = Microsoft.Office.Interop.Excel;

Now the above is basically possible only in ASP.NET. OTHERWISE gets the interface for Excel with the corresponding programming language.

. , .

0

.

Vba .. .

excel, , do-loops. :

Do 

If getVars = "" or getVars = Null Then
    Exit Do
End If

Set RangeOfStyles = Range("A1:Z400")

'Clear the xlSheet
For Each Cell In RangeOfStyles
        On Error Resume Next
        ActiveWorkbook.Styles(Cell.Text).Delete
        ActiveWorkbook.Styles(Cell.NumberFormat).Delete
Next Cell

DoEvents
'Use a counter for detecting the range of recieved data in table
'This only works if there is nospace inside the recieved data
'Create a start point
i = 2

'Find the start point
'Will be used if there are some data already found..
'If the starting cell is not empty than start counting
If Cells(i, 2) <> ""  Then

    Do
        Do
            i = i + 1          '2 cause my data starts at column "B2" and row 2
        Loop Until Cells(i + 1, 2) = "" 'if next cell is empty than it ends here
        'im leaving an empty row to seperate each data
        'i must check the row after the empty row to find out if there are more data
        '+1 for empty cell and +1 for starting cell
        i = i + 2
    Loop Until Cells(i, 2) = ""

End If

'Now that we are ready we can paste our next data to the next rows of our worksheet
'Get ur url pasted to the excel
With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;http://127.0.0.1" + getVars, _ 'I used your url here to make it more simpler
    Destination:=Range("B" & i, "I" & i))
    'Use this ability only if you need to gather a specific table in that page
    .WebSelectionType = "xlSpecifiedTables"
    'Webtables = "ChosenTable"
    .WebTables = "10"
    'The other attributes! Nothing fancy here..
    .BackgroundQuery = True
    .TablesOnlyFromHTML = True
    .Refresh BackgroundQuery:=False
    .SaveData = True   
End With


Loop
0

Source: https://habr.com/ru/post/1750076/


All Articles