Hi,
In my access form are the fields: NUM en TITLE, the purpose is that the bold red underlined intranettext is inserted in the formfield TITLE.
At our intranet we have a fixed location where default documents are placed with heir unique number.
With all the articles I found on the internet I was only able to open the browserpage with the specific document after the user had typed the number in the form field NUM.
In references I added:
- Microsoft HTML object library
- Microsoft XML, v 6.0
The code in Access:
Private Sub NR_AfterUpdate() '(after the user has typed the number een nr)
DoCmd.GoToControl "TITLE"
Dim Header As String
Dim IE As Object
Dim URL As String
Dim Doc As HTMLDocument
URL = "https://intranetwebsite/pagina/" & NUM
Set IE = CreateObject("InternetExplorer.Application")
IE.Silent = True
IE.Visible = True
IE.Navigate URL '(until here the code works fine, apart from a slow server)
'Below the code does not wait until the browser page is completed let alone gets the right content)
While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy
DoEvents
Wend
Set Doc = IE.HTMLDocument
Header = Doc.getElementsByTagName("h1")(0).innerText
TITLE = Header
End Sub
On our intranetpage part of the content is:
<h1 class="mx-text mx-name-text2 inline-block" id="mxui_widget_Wrapper_111" widgetId="mxui_widget_Wrapper_111" data-mendix-id="89_14_21">Beheersmodel Grote Projecten</h1>
Who can point me in the right direction?
Kind Regards,
Louis
In my access form are the fields: NUM en TITLE, the purpose is that the bold red underlined intranettext is inserted in the formfield TITLE.
At our intranet we have a fixed location where default documents are placed with heir unique number.
With all the articles I found on the internet I was only able to open the browserpage with the specific document after the user had typed the number in the form field NUM.
In references I added:
- Microsoft HTML object library
- Microsoft XML, v 6.0
The code in Access:
Private Sub NR_AfterUpdate() '(after the user has typed the number een nr)
DoCmd.GoToControl "TITLE"
Dim Header As String
Dim IE As Object
Dim URL As String
Dim Doc As HTMLDocument
URL = "https://intranetwebsite/pagina/" & NUM
Set IE = CreateObject("InternetExplorer.Application")
IE.Silent = True
IE.Visible = True
IE.Navigate URL '(until here the code works fine, apart from a slow server)
'Below the code does not wait until the browser page is completed let alone gets the right content)
While IE.ReadyState <> READYSTATE_COMPLETE Or IE.Busy
DoEvents
Wend
Set Doc = IE.HTMLDocument
Header = Doc.getElementsByTagName("h1")(0).innerText
TITLE = Header
End Sub
On our intranetpage part of the content is:
<h1 class="mx-text mx-name-text2 inline-block" id="mxui_widget_Wrapper_111" widgetId="mxui_widget_Wrapper_111" data-mendix-id="89_14_21">Beheersmodel Grote Projecten</h1>
Who can point me in the right direction?
Kind Regards,
Louis