By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

Using Access 2007 to automate Internet Explorer issue with drop down box selection

P: 8
I have data that sometimes needs to be uploaded to a 3rd party website and Iím trying to automate this process with Access 2007. Iím having a difficult time with my VBA syntax and with identifying the HTML names/idís of objects I want to control.

I have referenced Microsoft HTML Object Library & Microsoft Internet Controls and should note the version of Internet Explorer my company currently uses is IE6 (I know canít wait for an update)

Here is my current code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Testing17_Click()
  2.  
  3. On Error Resume Next
  4.  
  5. Dim IE As Object
  6. Dim document, element
  7. Dim btn As HTMLButtonElement
  8.  
  9. Set IE = CreateObject("internetexplorer.application")
  10.  
  11. IE.Navigate "https://www.quickbase.com/db/bc68fkzzg?a=ImportExport"
  12. IE.Visible = True
  13.  
  14. While IE.busy
  15. DoEvents
  16. Wend
  17.  
  18. For Each btn In IE.document.all.tags("Input")
  19. If btn.Value = "ImportClipboard" Then
  20. Call btn.Click
  21. End If
  22. Next btn
  23.  
  24. While IE.busy
  25. DoEvents
  26. Wend
  27.  
  28. End Sub
  29.  
The code above simply opens an instance of IE and navigates to the site (it does have a log in I think but I have my browser set to auto login) and selects a radio button for the Option ImportClipboard however there is a drop down box in which I need to select Reservations and this is the point I'm stuck at. I don't know the proper syntax to use and I tried using the above code with variations such as:

Expand|Select|Wrap|Line Numbers
  1. For Each btn In IE.document.all.tags("Select")
  2. If btn.Value = "Reservations" Then
  3. Call btn.Click
  4. End If
  5. Next btn
  6.  
But nothing happens (and no error messages). I'm wondering if I should be using a click for the dropdown selection as well.

Iíve followed the instructions from this site (http://www.tek-tips.com/faqs.cfm?fid=6399) and pasted into excel and will include in an attachment (Iíve highlighted the row in green that I think has the pertinent info). I've also attached some of the HTML from the site on the additional pages if that helps.

Also any reference sites/links anyone can suggest that a beginner could follow I'd appreciate it as I've found several similar issues for excel but nothing specific for dropdown boxes or a list of Internet Controls for Access.
Apr 28 '10 #1
Share this Question
Share on Google+
1 Reply


P: 8
Hate to reply to my own thread but in case anyone else comes across this figured I'd show the code that worked for me which took me two days and a lot of trial and error...



Expand|Select|Wrap|Line Numbers
  1. Private Sub Testing17_Click()
  2.  
  3. On Error Resume Next
  4.  
  5. Dim IE As Object
  6. Dim document, element
  7. Dim btn As HTMLButtonElement
  8.  
  9. Set IE = CreateObject("internetexplorer.application")
  10.  
  11. IE.Navigate "https://www.quickbase.com/db/bc68fkzzg?a=ImportExport"
  12. IE.Visible = True
  13.  
  14. While IE.Busy
  15. DoEvents
  16. Wend
  17.  
  18.  
  19. For Each btn In IE.document.all.tags("Input")
  20. If btn.Value = "ImportClipboard" Then
  21. Call btn.Click
  22. End If
  23. Next btn
  24.  
  25. While IE.Busy
  26. DoEvents
  27. Wend
  28.  
  29. 'This is what selects the table and then the element in the drop down/combo box
  30. IE.document.all.Item("table").Value = "bc68fkzzi"  
  31.  
  32. Set IE = Nothing
  33.  
  34. End Sub
Apr 29 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.