megatronixs
Registered User.
- Local time
 - Today, 07:44
 
- Joined
 - Aug 17, 2012
 
- Messages
 - 719
 
Hi all,
 
I made some code work to login into a intranet site and then after login in go to the page after filling in some fields there, I get a results in a new page. I want to get the data from there. So far I made it work with Excel, but the idea is to have Access for this.
This is the code part from Excel:
	
	
	
		
 
How to do this in Access?
This is the code so far for access:
	
	
	
		
 
I hope some one can help
Greetings.
 I made some code work to login into a intranet site and then after login in go to the page after filling in some fields there, I get a results in a new page. I want to get the data from there. So far I made it work with Excel, but the idea is to have Access for this.
This is the code part from Excel:
		Code:
	
	
	   'copy the tables html to the clipboard and paste to teh sheet
    If Not ieTable Is Nothing Then
        Set clip = New DataObject
        clip.SetText "<html>" & ieTable.outerHTML & "</html>"
        clip.PutInClipboard
        Sheet1.Select
        Sheet1.Range("A1").Select
        Sheet1.PasteSpecial "text"
    End If
	How to do this in Access?
This is the code so far for access:
		Code:
	
	
	Private Sub btn_open_and_get_data_Click()
Dim ie As Object
    Dim Form As Variant, button As Variant
    Dim Str As String
    Dim objIe As Object
    Dim xobj
    Dim vfrr As HTMLTextElement
    Dim HTMLdoc As MSHTML.HTMLDocument
    Dim FinalRow As Long, i As Long
    Dim Client As String
    Dim Account As String
    Dim PDF As String
    Dim ieDoc As Object
    Dim ieTable As Object
    Set ie = CreateObject("InternetExplorer.Application")
    ie.Visible = True
    ie.navigate "[URL]https://my[/URL] intranetsite"
    While ie.ReadyState <> 4
        DoEvents
    Wend
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = ie.Document.Forms("Home").Document
HTMLdoc.getElementById("txtUserName").Value = Me.txt_user.Value
HTMLdoc.getElementById("txtPassword").Value = Me.txt_password
HTMLdoc.getElementById("login").Click
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = ie.Document.Forms("analystSearchForm").Document
HTMLdoc.getElementById("showID").Click
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = ie.Document.Forms("analystSearchForm").Document
HTMLdoc.getElementById("initiationTest").Value = "Test 3"
Set HTMLdoc = ie.Document.Forms("analystSearchForm").Document
HTMLdoc.getElementById("initiationTest").Value = "Test 1"
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = ie.Document.Forms("analystSearchForm").Document
HTMLdoc.getElementById("unassignedInitiations").Checked = True
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = ie.Document.Forms("analystSearchForm").Document
HTMLdoc.getElementById("assignedInitiation").Checked = False
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = ie.Document.Forms("analystSearchForm").Document
HTMLdoc.getElementById("searchButton").Click
'
While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
    'get the table based on the table’s id
    Set HTMLdoc = ie.Document
    HTMLdoc.getElementById ("tableGrid")
    Set ieTable = HTMLdoc.all.Item("tableGrid")
    'copy the tables html to the clipboard and paste to the table
    If Not ieTable Is Nothing Then
    End If
End Sub
	I hope some one can help
Greetings.