Macro to fill a Microsoft Edge form with data from an Excel sheet

fabcat1

New Member
Joined
May 20, 2022
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Hi,



I’d like to create a macro which would generate entries in a database filling a Microsoft-Edge form from an Excel file (1 page for each line of the Excel file)



The steps are :


  1. Declare the variables
    • Dim ws As Worksheet
    • Dim i As Integer
    • Dim lastrow As Integer
  2. Open the Excel worksheet “Data”
    • Set ws = ThisWorkbook.Sheets("Data")
  3. Open a Microsoft-Edge page “mypage”
  4. Temporisation to ensure the page is loaded
  5. Fill textboxes with the content of the Excel sheet cells ws.Cells(i, 1), ws.Cells(i, 2), ws.Cells(i, 3), ws.Cells(i, 4)
    • Type=”text” id=”textbox1” , Type=”text” id=”textbox2” Type=”text” id=”textbox3” Type=”text” id=”textbox4”
  6. Click the “submit” button
    • Type=”button” id=”submit_button”
  7. Increment i and fill another entry (loop steps 3 to 6)
  8. Loop until ws.Cell(i, 2) is empty


Can someone please help ?



Thanks a lot
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Upvote 0
Study up on Selenium for VBA. I use it all the time to control webpage data insertion and data dumping.

Here is a good tutorial to start:
Shknbk2

Thanks for your answer

Unfortunately it doesn't help me

I have to use an Edge page (in a professional environment) and populate it

So far I can open the page but I can't set a tempo to ensure the page is loaded before I fill the fields.

so far my code is as follow

Can you please help me with the tempo ?
Thanks


Sub OpenEdge()
Dim Edge As Object
Dim objelement As Object
Dim c As Integer
Dim LastRow, i, j As Integer

Set Edge = CreateObject("shell.Application")

With Edge


'ouvrir la page de saisie d'une nouvelle demande
ActiveWorkbook.FollowHyperlink Address:="microsoft-edge:https://teams.company/sites/NewForm.aspx?RootFolder="


'temporisation


'remplir le titre de la demande
obj.FindElementByName("Titre Champ obligatoire").SendKeys ("titre_test")


'créer la nouvelle demande
obj.FindElementByPath("//*[@value='SubmitToApprobationButton']").Click




End With

End Sub
 
Upvote 0
Study up on Selenium for VBA. I use it all the time to control webpage data insertion and data dumping.

Here is a good tutorial to start:
Also, I can't use Selenium as it's not validated by the IT service of my company so far
 
Upvote 0
Are you able to populate the page using your code once it is loaded? For example, if you put in a wait block of 10 seconds to make sure it is loaded, can you fill the objects with data?
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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