0

col1 =映画ID、col2 =映画名のExcelに次の表があります。リスト内のすべての映画の制作会社名を取得するために、Excel Web クエリを使用しようとしています。

ID          Movie Name
tt1540741   A Single Shot (2013)
tt4630158   A Space Program (2015 Documentary)

http://www.omdbapi.com/?i=tt2330270&tomatoes=true&plot=short&r=xml

リンクは、生産会社名を含む XML を返します。

この目標を達成するための Excel 数式の書き方がわかりません。

(出力をこのようにしたい)

ID          Movie Name                         Production firm
tt1540741   A Single Shot (2013)                      ABC
tt4630158   A Space Program (2015 Documentary)        DEF
4

1 に答える 1

0

問題が解決しました。これが私の解決策です。ここでは行番号が固定されていることに注意してください。動的に変更できます。

ここの列 A には、一意の映画 ID を持つすべての URL が含まれています。例えば

http://www.omdbapi.com/?i=tt0811137&tomatoes=true&plot=short&r=xml

Sub getMovieInfo()
'  Application.ScreenUpdating = False
  Dim x As Integer
  ' Set numrows = number of rows of data.
  NumRows = 1491
  ' Select cell a1.
  Range("A1").Select
  ' Establish "For" loop to loop "numrows" number of times.
  For x = 1 To 1491
     ' Insert your code here.
     pos = "A" & x
     des = "$D" & x
    ActiveWorkbook.XmlImport URL:=Cells.Item(x, "A"), _
    ImportMap:=Nothing, Overwrite:=True, Destination:=Sheets("Sheet3").Range(des)
   ' Sheets("Sheet1").Range(des).Value = Cells.Item(x, "A")
    Application.Wait (Now + TimeValue("00:00:2"))

    If (IsEmpty(Sheets("sheet3").Range(des)) = True) Then
    Application.Wait (Now + TimeValue("00:00:10"))
        If (IsEmpty(Sheets("sheet3").Range(des)) = True) Then
        Exit Sub
        End If
    End If

     ActiveCell.Offset(1, 0).Select
  Next
  End Sub
于 2016-07-10T14:38:04.703 に答える