Hi!


I’m trying to populate data from Excel to  DHIS2 Data Entry Web Form using
VBA code in Excel with Internet Explorer, the data goes to form but not
persisted to database. Anyone already try to do that?



The VBA code, tested to fill form in the demo instance:



'Before run this Macro make sure to login into dhis2-demo using Internet
Explorer

Sub FillInternetForm()

Dim IE As Object



Set IE = CreateObject("InternetExplorer.Application")



IE.Navigate "https://play.dhis2.org/demo/dhis-web-dataentry/index.action";

IE.Visible = True



While IE.busy

DoEvents 'wait until IE is done loading page.

Wend



'You have 30 seconds to choose Orgunit, form and period

'Eg. Sierra Leone, Emergency Response, Result

Application.Wait Now + TimeValue("00:00:30")



'Populating Data to two first fields

IE.document.getElementById("KFnFpbqDqji-bRowv6yZOF2-val").Focus

IE.document.getElementById("KFnFpbqDqji-bRowv6yZOF2-val").Value = "20"

Application.Wait Now + TimeValue("00:00:02")

IE.document.getElementById("zFFb3bar4Ct-bRowv6yZOF2-val").Focus

IE.document.getElementById("zFFb3bar4Ct-bRowv6yZOF2-val").Value = "30"



End Sub



The result:





The Data goes to the field but not persisted, the field don’t change color.

I appreciate your help if you can provide.



Thank you

*Damasceno Lopes,  MSc*

*Health Information System Officer*

Friends in Global Health, Mozambique

*+258844626770 <+258%2084%20462%206770>*  | *+258829502145
<damasceno.lo...@fgh.org.mz>*

[image: FGH]
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to