Last active
August 29, 2015 14:04
-
-
Save naichilab/fef5dcc0f8266fd83293 to your computer and use it in GitHub Desktop.
【ExcelVBA】IE開いて全部コピーして閉じる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Attribute VB_Name = "IE_open_copy" | |
'IEで特定のページを開き、全コピー(CTRL+A、CTRL+C)をしてIEを閉じる | |
'Excelに戻り、CTRL+Vを行う | |
Sub IE_open_copy() | |
Dim objIE As Object | |
Const OLECMDID_SELECTALL = 17 | |
Const OLECMDID_COPY = 12 | |
Const OLECMDEXECOPT_DODEFAULT = 0 | |
'目的のwebページ | |
Const URL As String = "http://ja.wikipedia.org/wiki/CAT" | |
Set objIE = CreateObject("InternetExplorer.Application") | |
With objIE | |
.Visible = True | |
.navigate URL | |
Do While .busy | |
DoEvents | |
Loop | |
Do Until .readystate = 4 | |
DoEvents | |
Loop | |
.execwb OLECMDID_SELECTALL, OLECMDEXECOPT_DODEFAULT | |
.execwb OLECMDID_COPY, OLECMDEXECOPT_DODEFAULT | |
.Quit | |
End With | |
AppActivate Application.Caption, True | |
Range("A1").Select | |
Application.SendKeys "^v" | |
Set objIE = Nothing | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment