I have VBA Code where I am able to browse webpage but Sendkeys "^a", "^c" not working. Tried multiple times but no luck.
Please suggest.
Using this code:
Set DestinationWorksheet = ActiveSheet
Dim myURL As String
Dim HTMLdoc As HTMLDocument
Dim TDelements As IHTMLElementCollection
Dim TDelement As HTMLTableCell
Dim r As Long
Dim date_now As String
Set ie = CreateObject("InternetExplorer.Application")
myURL = "https://www.annauniv.edu/pdf/pdf19.pdf"
With ie
.navigate myURL
.Visible = True
Do While ie.busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set HTMLdoc = .document
End With
SendKeys "^a" ' Select all in PDF document
SendKeys "^c" ' Copy selected contents
Application.Wait Now + TimeValue("00:00:02") ' Wait a little to give clipboard time to copy (if huge contents)
DoEvents
SendKeys "^q" ' Close PDF document
Application.Wait Now + TimeValue("00:00:01") ' Wait a little to give document time to close completely
Application.Run "ActivateExcel", True ' Re-activate Excel in case another application was activate when closing PDF Reader
DoEvents
Err.Clear
DestinationWorksheet.Paste ' Paste PDF contents into worksheet
I expect the data to be pasted in activesheet of excel