endlessracin
08-06-2010, 09:06 AM
Note: I cannot have links so I chopped off the major portion of the links but you should still get the idea I hope.
I searched and read for examples to help me but I have not been able to adapt any of the examples I have found for what I need.
Essentially I am constructing a Access Database for a Movie Collection. I have a form setup with all the nessesary information. Upon entering the Movie Title in the form I allow the user to click the "Download Info" button.
The Download Info button will search the IMDB for the movie title. For example.
strMovieTitle = "Hollow man 2"
I can search the IMDB via:
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = True
.Navigate "find?s=all&q=" & strMovieTitle
End With
While objIE.Busy
Wend
While objIE.Document.ReadyState <> "complete"
Wend
This brings me to a page a results page. Essentially what I want to do is go to the "Titles (Exact Matches)" section of the page and "click" that link or rather take the ID they use which is found in the following link: /title/tt0469916/
MovieID = "tt0469916"
I have tried doing this using commands like:
strMovieTitle = InStr(objIE.Document.Body.innerHTML, "Titles (Exact Matches)")
strMovieTitle = Mid(objIE.Document.Body.innerHTML, strMovieTitle + 50, 100)
But this does not return any of the link information.
I have also tried:
For Each Link In objIE.Document.Links
If (InStr(Link, "/title/")) Then
MovieID = Mid(Link, 26)
End If
Next Link
But this gives me a MovieID = "/tt0164052/"
Which is the wrong MovieID.
After I solve that issue or how to correctly do what I want there. I then want to navigate to the movie page and from there pull all the info about the movie to populate the Access Form for review and storage into the DB.
Can anyone help me? I am new to VBA outside of working with Excel and only its components.
I searched and read for examples to help me but I have not been able to adapt any of the examples I have found for what I need.
Essentially I am constructing a Access Database for a Movie Collection. I have a form setup with all the nessesary information. Upon entering the Movie Title in the form I allow the user to click the "Download Info" button.
The Download Info button will search the IMDB for the movie title. For example.
strMovieTitle = "Hollow man 2"
I can search the IMDB via:
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = True
.Navigate "find?s=all&q=" & strMovieTitle
End With
While objIE.Busy
Wend
While objIE.Document.ReadyState <> "complete"
Wend
This brings me to a page a results page. Essentially what I want to do is go to the "Titles (Exact Matches)" section of the page and "click" that link or rather take the ID they use which is found in the following link: /title/tt0469916/
MovieID = "tt0469916"
I have tried doing this using commands like:
strMovieTitle = InStr(objIE.Document.Body.innerHTML, "Titles (Exact Matches)")
strMovieTitle = Mid(objIE.Document.Body.innerHTML, strMovieTitle + 50, 100)
But this does not return any of the link information.
I have also tried:
For Each Link In objIE.Document.Links
If (InStr(Link, "/title/")) Then
MovieID = Mid(Link, 26)
End If
Next Link
But this gives me a MovieID = "/tt0164052/"
Which is the wrong MovieID.
After I solve that issue or how to correctly do what I want there. I then want to navigate to the movie page and from there pull all the info about the movie to populate the Access Form for review and storage into the DB.
Can anyone help me? I am new to VBA outside of working with Excel and only its components.