(Solved) – Printing a webpage using selenium in VBA

(solved)-–-printing-a-webpage-using-selenium-in-vba

I am trying to print a webpage using selenium in VBA. I want the bot to be able to press control P and then Enter on the printing dialog but keep getting an object required error. Anyone have any ideas?

Sub printing()

    Dim bot As New WebDriver, controlP As Variant, enter As Variant

    bot.Start "chrome", ""

    bot.Get "https://www.google.com/"

    controlP = (Keys.Control & "p")

    enter = (Keys.enter)

    bot.FindElementByXPath("https://stackoverflow.com/html").SendKeys (conrolP)

    bot.FindElementByXPath("https://stackoverflow.com/html").SendKeys (enter)

End sub

Leave a Reply

Your email address will not be published. Required fields are marked *