简体   繁体   中英

Copy and Paste from a URL using VBA

I have a button that calls a sub DBA()

I would like this sub to visit a particular URL (for example: https://index.db.com ) and copy all of the content and paste it into Application.Worksheets("DBA").

More specifically, I would ideally like to copy and paste the contents from a div that has an id="constituentstable" in the URL's HTML

Grateful for any guidance, thank you,

A very basic approach would be to use SendKeys. I'm not experienced in opening websites with Excel, but once you have it open, just use

Application.SendKeys "^A", True
Application.SendKeys "^C", True

and that will select everything in the website and copy it's contents. But I think it would be helpful to look at the link on the comment of your post.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM