VBA HTML - Not able to create hyperlinks

  • I am using a VBA macro to populate the pages of a flashcard website.

    In one of the text fields, I need to enter a URL. When I do this task manually, as soon as paste the URL into the field and press the Enter button, the URL turns into a hyperlink. So when I review the flashcard later, I can click on the URL and open the relevant web page in another tab.

    However, when I use the following code to populate that field, the URL doesn't become a hyperlink, but remains text. Is there way I can ensure that the URL becomes a hyperlink?

    Thanks


    Code
    1. htmlDoc.getElementById("Front").innertext = String1
    2. htmlDoc.getElementById("Back").innertext = "https://www.history.com/topics/china/genghis-khan"
    3. htmlDoc.getElementById("GoNextcard").Click