セッションを自動的に開始することにより、Ms.Excel 2007でWebクエリを自動化する方法についての知識を共有できる人はいますか?
私の問題は、毎回Webクエリを介して手動でログインする必要があることです。
セッションを自動的に開始することにより、Ms.Excel 2007でWebクエリを自動化する方法についての知識を共有できる人はいますか?
私の問題は、毎回Webクエリを介して手動でログインする必要があることです。
C#COMインターフェイスを使用してExcelにデータを注入できます......次の検索キーワードでGoogleを押すと、100の結果が得られます
Excelを使用=Microsoft.Office.Interop.Excel;
現在、上記は基本的にASP.NETでのみ可能です。それ以外の場合は、対応するプログラミング言語でExcel用のインターフェイスを取得します。
このuがいくつかのアイデアを得るのを参照してください。
私は正確な問題を抱えています..
少し Vba マクロを使用すると、データ転送を自動化できます..しかし、まだセッションを手動で開始する必要があります..
ほんの少しのコードで、Excel へのデータ転送を自動化できます。いくつかの do ループを使用して、各データ行を行ごとに自動的に書き留めることができます。例えば;
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
私の経験では、それは不可能です。Excel の Web クエリ インターフェイスには、それを行う機能がありません。VBA を介して Web データを取得し、それをシートに貼り付けて、ログイン部分を自動化することにしました。http://www.dailydoseofexcel.com/archives/2011/03/08/get-data-from-website-that-requires-a-login/を参照し、コメントを必ずお読みください。