VBA code sample for IE and Excel

imgaur7

New Member
Joined
Dec 25, 2017
Messages
32
Hi,


I am working on some web data fill design and need your help and time here, I tried to put the need in a very simple way (i think) for better


understand and based on that MAY be I will be able to get to the goal.


Considering demo html/xml page and excel file which contains data to process


In a web page the drop down or text or checkbox are defined with their class name and option are numbers, and this is help to find and fill the


data


Flow Chart Step Data
Open IE Page from Excel URL Excel Data
Search for Div Class Excel Data
search for option value Excel Data
Fill the data as per option value
Search for Div Class Excel Data
search for option value Excel Data
Fill the data as per option value
Search for Div Class Excel Data
Enter the text in box Excel Data
Search for Div Class Excel Data
Select checkbox based on option Excel Data
wait for 5 sec
submit form
close IE Current page
Loop the process till last value in excel
-----------------------------------------------------------------------


for example please refer below data sheet

[TABLE="width: 1188"]
<tbody>[TR]
[TD]Web page[/TD]
[TD]Div Class[/TD]
[TD]option value[/TD]
[TD]Div Class[/TD]
[TD]option value[/TD]
[TD]Div Class (Text)[/TD]
[TD]Div Class (Checkbox) Option[/TD]
[TD]Wait time before review (sec)[/TD]
[TD]Wait time before Submit (sec)[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program[/TD]
[TD]XXX15[/TD]
[TD]Test_program1[/TD]
[TD]XXX18[/TD]
[TD]abcd[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]zzzz.com[/TD]
[TD]Test_program2[/TD]
[TD]XXX16[/TD]
[TD]Test_program2[/TD]
[TD]XXX19[/TD]
[TD]ghghhtytjnmj[/TD]
[TD]3[/TD]
[TD]6[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program3[/TD]
[TD]XXX17[/TD]
[TD]Test_program3[/TD]
[TD]XXX20[/TD]
[TD]edfr[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]yyyxxx.com[/TD]
[TD]Test_program4[/TD]
[TD]XXX18[/TD]
[TD]Test_program4[/TD]
[TD]XXX21[/TD]
[TD]thsd[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program5[/TD]
[TD]XXX19[/TD]
[TD]Test_program5[/TD]
[TD]XXX22[/TD]
[TD]vgrffg[/TD]
[TD]7[/TD]
[TD]5[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program6[/TD]
[TD]XXX20[/TD]
[TD]Test_program6[/TD]
[TD]XXX23[/TD]
[TD]bhytgj[/TD]
[TD]8[/TD]
[TD]5[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]



Kindly help.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi,


I am working on some web data fill design and need your help and time here, I tried to put the need in a very simple way (i think) for better


understand and based on that MAY be I will be able to get to the goal.


Considering demo html/xml page and excel file which contains data to process


In a web page the drop down or text or checkbox are defined with their class name and option are numbers, and this is help to find and fill the


data


Flow Chart Step Data
Open IE Page from Excel URL Excel Data
Search for Div Class Excel Data
search for option value Excel Data
Fill the data as per option value
Search for Div Class Excel Data
search for option value Excel Data
Fill the data as per option value
Search for Div Class Excel Data
Enter the text in box Excel Data
Search for Div Class Excel Data
Select checkbox based on option Excel Data
wait for 5 sec
submit form
close IE Current page
Loop the process till last value in excel
-----------------------------------------------------------------------


for example please refer below data sheet

[TABLE="width: 1188"]
<tbody>[TR]
[TD]Web page[/TD]
[TD]Div Class[/TD]
[TD]option value[/TD]
[TD]Div Class[/TD]
[TD]option value[/TD]
[TD]Div Class (Text)[/TD]
[TD]Div Class (Checkbox) Option[/TD]
[TD]Wait time before review (sec)[/TD]
[TD]Wait time before Submit (sec)[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program[/TD]
[TD]XXX15[/TD]
[TD]Test_program1[/TD]
[TD]XXX18[/TD]
[TD]abcd[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]zzzz.com[/TD]
[TD]Test_program2[/TD]
[TD]XXX16[/TD]
[TD]Test_program2[/TD]
[TD]XXX19[/TD]
[TD]ghghhtytjnmj[/TD]
[TD]3[/TD]
[TD]6[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program3[/TD]
[TD]XXX17[/TD]
[TD]Test_program3[/TD]
[TD]XXX20[/TD]
[TD]edfr[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]yyyxxx.com[/TD]
[TD]Test_program4[/TD]
[TD]XXX18[/TD]
[TD]Test_program4[/TD]
[TD]XXX21[/TD]
[TD]thsd[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program5[/TD]
[TD]XXX19[/TD]
[TD]Test_program5[/TD]
[TD]XXX22[/TD]
[TD]vgrffg[/TD]
[TD]7[/TD]
[TD]5[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program6[/TD]
[TD]XXX20[/TD]
[TD]Test_program6[/TD]
[TD]XXX23[/TD]
[TD]bhytgj[/TD]
[TD]8[/TD]
[TD]5[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]



Kindly help.

Still looking to get it shorted in way and got some codes but my issue is that they are not picking the web address from excel sheet to open the page

This is my VBA code:

Code:
[/COLOR]
[COLOR=#574123]Sub Test1()[/COLOR]
[COLOR=#574123]Dim IE As Object[/COLOR]
[COLOR=#574123]Set IE = CreateObject("InternetExplorer.application")[/COLOR]
[COLOR=#574123]With IE[/COLOR]
[COLOR=#574123].Visible = True[/COLOR]
[COLOR=#574123]'.navigate ("http://auros.co.uk/default.aspx")[/COLOR]
[COLOR=#574123]'.navigate ("http://glenigan-cms.auros.co.uk")[/COLOR]
[COLOR=#574123].navigate ("http://rhuprdbibo01.rexelusa.com:8080/InfoViewApp/logon.jsp")[/COLOR]
[COLOR=#574123]While .Busy Or .readyState <> 4: DoEvents: Wend[/COLOR]
[COLOR=#574123].Document.getElementById("logon_input_label_password").Focus[/COLOR]
[COLOR=#574123].Document.getElementById("logon_input_label_password").Value = ""[/COLOR]
[COLOR=#574123].Document.all("Template_GLE_Login_LoginView1_login_LoginButton").Click[/COLOR]
[COLOR=#574123]While .Busy Or .readyState <> 4: DoEvents: Wend[/COLOR]
[COLOR=#574123]Debug.Print .LocationURL[/COLOR]
[COLOR=#574123]End With[/COLOR]
[COLOR=#574123]End Sub[/COLOR]
[COLOR=#574123][code]


I wanted to open a web page based on the excel sheet data and then try to fill the relative fields (based on excel values only)


[/COLOR]
 
Upvote 0
Hi,


I am working on some web data fill design and need your help and time here, I tried to put the need in a very simple way (i think) for better


understand and based on that MAY be I will be able to get to the goal.


Considering demo html/xml page and excel file which contains data to process


In a web page the drop down or text or checkbox are defined with their class name and option are numbers, and this is help to find and fill the


data


Flow Chart Step Data
Open IE Page from Excel URL Excel Data
Search for Div Class Excel Data
search for option value Excel Data
Fill the data as per option value
Search for Div Class Excel Data
search for option value Excel Data
Fill the data as per option value
Search for Div Class Excel Data
Enter the text in box Excel Data
Search for Div Class Excel Data
Select checkbox based on option Excel Data
wait for 5 sec
submit form
close IE Current page
Loop the process till last value in excel
-----------------------------------------------------------------------


for example please refer below data sheet

[TABLE="width: 1188"]
<tbody>[TR]
[TD]Web page[/TD]
[TD]Div Class[/TD]
[TD]option value[/TD]
[TD]Div Class[/TD]
[TD]option value[/TD]
[TD]Div Class (Text)[/TD]
[TD]Div Class (Checkbox) Option[/TD]
[TD]Wait time before review (sec)[/TD]
[TD]Wait time before Submit (sec)[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program[/TD]
[TD]XXX15[/TD]
[TD]Test_program1[/TD]
[TD]XXX18[/TD]
[TD]abcd[/TD]
[TD]1[/TD]
[TD]5[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]zzzz.com[/TD]
[TD]Test_program2[/TD]
[TD]XXX16[/TD]
[TD]Test_program2[/TD]
[TD]XXX19[/TD]
[TD]ghghhtytjnmj[/TD]
[TD]3[/TD]
[TD]6[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program3[/TD]
[TD]XXX17[/TD]
[TD]Test_program3[/TD]
[TD]XXX20[/TD]
[TD]edfr[/TD]
[TD]5[/TD]
[TD]7[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]yyyxxx.com[/TD]
[TD]Test_program4[/TD]
[TD]XXX18[/TD]
[TD]Test_program4[/TD]
[TD]XXX21[/TD]
[TD]thsd[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program5[/TD]
[TD]XXX19[/TD]
[TD]Test_program5[/TD]
[TD]XXX22[/TD]
[TD]vgrffg[/TD]
[TD]7[/TD]
[TD]5[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]xxx.com[/TD]
[TD]Test_program6[/TD]
[TD]XXX20[/TD]
[TD]Test_program6[/TD]
[TD]XXX23[/TD]
[TD]bhytgj[/TD]
[TD]8[/TD]
[TD]5[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]



Kindly help.

Waiting for suggestions and help, thanks
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,262
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top