Using IE via VBA, copy pasting

Nickmite

New Member
Joined
Feb 17, 2014
Messages
12
Hi all,

In brief, webquery cannot import JavaScript, that's why I thought it could be easier just to make VBA do following:

Switch to internet explorer, go to web Topic Related Searching at ANY.COM., wait 30 sec, select all (as if ctrl+a), then copy (as if ctrl+c), then back to VBA application and paste in cell A1.

Would that be possible? I am obviously quite new to VBA and will appreicate any help. A working code would be a lovely xmas present!

Thanks in advance.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Re: Using IE via VBA, copy oasting

Code:
Sub myMacro()
     myInputBox = ("Enter the URL of the website.")
     FollowHyperlink myInputBox
     Application.Wait(Now + TimeValue("00:00:30"))
     SendKeys "^a"
     SendKeys "^c"
     Application.Paste Destination:= Range("A1")
End Sub
 
Upvote 0
Re: Using IE via VBA, copy oasting

Code:
Sub myMacro()
     myInputBox = ("Enter the URL of the website.")
     FollowHyperlink myInputBox
     Application.Wait(Now + TimeValue("00:00:30"))
     SendKeys "^a"
     SendKeys "^c"
     Application.Paste Destination:= Range("A1")
End Sub

Thanks! But when I try execute it breaks saying sub or function is not defined, at FollowHyperlink
 
Upvote 0
That's weird. Its thinking that myInputBox is a Sub but its an input box. Try this
FollowHyperlink myInputBox, True

or this
FollowHyperlink "http://www.your website.com", True
 
Upvote 0

Forum statistics

Threads
1,215,945
Messages
6,127,856
Members
449,411
Latest member
adunn_23

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