|
▼はる さん:
おはようございます。
サンプルとして、
新規ブックの標準モジュールに
'============================================================
Option Explicit
Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal _
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Declare Function GetVersionExA Lib "kernel32" _
(lpVersionInformation As OSVERSIONINFO) As Integer
Public Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Public Const KEYEVENTF_KEYUP = &H2
Public Const VK_SNAPSHOT = &H2C
Public Const VK_MENU = &H12
'==============================================================
Sub test()
Dim blnAboveVer4 As Boolean
Dim osinfo As OSVERSIONINFO
Dim retvalue As Integer
osinfo.dwOSVersionInfoSize = 148
osinfo.szCSDVersion = Space$(128)
retvalue = GetVersionExA(osinfo)
If osinfo.dwMajorVersion > 4 Then blnAboveVer4 = True
With CreateObject("InternetExplorer.Application")
.Visible = True
.Navigate "HTTP://www.vbalab.net/"
' ↑このHTTPを半角の小文字に直してください
Do While .busy = True
DoEvents
Loop
If blnAboveVer4 Then
keybd_event VK_SNAPSHOT, 1, 0, 0
Else
keybd_event VK_MENU, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, 0, 0
keybd_event VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
End If
DoEvents
.Quit
End With
With ActiveSheet
.Range("a1").Activate
.Paste
End With
End Sub
として、testを実行してみてください。
このHPをハードコピーします。
尚、ハードコピーに関しては、
www.vbalab.net/vbaqa/c-board.cgi?cmd=one;no=18531;id=excel
これを参考にしました。
|
|