calc.exe 電卓にsendkeysでDEC2HEX DEC2BINをやらせる
Office VBA 言語リファレンス Visual Basic 言語リファレンス ステートメント
SendKeys ステートメント
https://msdn.microsoft.com/ja-jp/library/office/gg278655.aspx
Qword 64bit FFFFFFFFFFFFFFFF に戻すFUNCTION KEY 不明 Calc.exeを再起動するしかない?
Dword 32bit FFFFFFFF F2
Word 16bit FFFF F3
Byte 8bit FF F4
16進 F5
10進 F6
8進 F7
2進 F8
ExcelをD4からG64を文字列にして 下記貼り付け
サクラエディタ正規表現とかで スペースを\t(タブ)変換してExcelに貼り付け(”+"を”\t”)。
-1 1111111111111111 FFFF
-2 1111111111111110 FFFE
-3 1111111111111101 FFFD
-4 1111111111111100 FFFC
-5 1111111111111011 FFFB
-6 1111111111111010 FFFA
-7 1111111111111001 FFF9
-8 1111111111111000 FFF8
-9 1111111111110111 FFF7
-15 1111111111110001 FFF1
-16 1111111111110000 FFF0
-17 1111111111101111 FFEF
-31 1111111111100001 FFE1
-32 1111111111100000 FFE0
-33 1111111111011111 FFDF
-63 1111111111000001 FFC1
-64 1111111111000000 FFC0
-65 1111111110111111 FFBF
-127 1111111110000001 FF81
-128 1111111110000000 FF80
-129 1111111101111111 FF7F
-255 1111111100000001 FF01
-256 1111111100000000 FF00
-257 1111111011111111 FEFF
-511 1111111000000001 FE01
-512 1111111000000000 FE00
-513 1111110111111111 FDFF
-1023 1111110000000001 FC01
-1024 1111110000000000 FC00
-1025 1111101111111111 FBFF
-2047 1111100000000001 F801
-2048 1111100000000000 F800
-2049 1111011111111111 F7FF
-4095 1111000000000001 F001
-4096 1111000000000000 F000
-4097 1110111111111111 EFFF
-8191 1110000000000001 E001
-8192 1110000000000000 E000
-8193 1101111111111111 DFFF
-16383 1100000000000001 C001
-16384 1100000000000000 C000
-16385 1011111111111111 BFFF
-32767 1000000000000001 8001
-32768 1000000000000000 8000
0 0000000000000000 0000
1 0000000000000001 0001
2 0000000000000010 0002
4 0000000000000100 0004
8 0000000000001000 0008
16 0000000000010000 0010
32 0000000000100000 0020
64 0000000001000000 0040
128 0000000010000000 0080
256 0000000100000000 0100
512 0000001000000000 0200
1024 0000010000000000 0400
2048 0000100000000000 0800
4096 0001000000000000 1000
8192 0010000000000000 2000
16384 0100000000000000 4000
32767 0111111111111111 7FFF
とりあえずXPで7は後日(プログラマ電卓にする必要がある)
Sub test003()
Application.ScreenUpdating = False
Dim ReturnValue
Dim i
ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
AppActivate ReturnValue ' Activate the Calculator.
i = 4
SendKeys "%VS~", True 'Alt+VでS選択
Do Until Range("D" & i).Value = "" ' Set up counting loop.
SendKeys "{F6}", True 'FunctionF6 10進選択
Range("D" & i).Copy '対象Cell Copy
SendKeys "^V", True 'Ctrl+v Paste
'SendKeys "=", True '"="送ると-Minus消えるのでやらない
SendKeys "{F5}", True 'FunctionF5 16進選択
SendKeys "^C", True 'Ctrl+c Copy
Range("G" & i).Select 'G列Select
ActiveSheet.Paste 'Paste
SendKeys "{F8}", True 'FunctionF8 2進選択
SendKeys "^C", True 'Ctrl+c Copy
Range("H" & i).Select 'H列Select
ActiveSheet.Paste 'Paste
i = i + 1
Loop ' to add each value of I.
'SendKeys "=", True ' Get grand total.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
Application.ScreenUpdating = True
End Sub
<20160927追記sta>
win7で動かす用 電卓との同期が必要みたいなのでWaitをかます。
Sub test004()
Application.ScreenUpdating = False
Dim ReturnValue
Dim i
ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
Call WaitTime("0:00:02")
AppActivate ReturnValue ' Activate the Calculator.
i = 4
'SendKeys "%VS~", True 'Alt+VでS選択 XPの関数電卓
SendKeys "%3~", True 'Alt+3 win7のプログラマ電卓
Call WaitTime("0:00:01")
Do Until Range("D" & i).Value = ""
SendKeys "{F6}", True 'FunctionF6 10進選択
Range("D" & i).Copy '対象Cell Copy
SendKeys "^V", True 'Ctrl+v Paste
'SendKeys "=", True '"="送ると-Minus消えるのでやらない
SendKeys "{F5}", True 'FunctionF5 16進選択
' Qword 64bit
'SendKeys "{F5}{F3}", True 'F2 Dword 32bit
'SendKeys "{F5}{F3}", True 'F3 Word 16bit
'SendKeys "{F5}{F4}", True 'F4 Byte 8bit
SendKeys "^C", True 'Ctrl+c Copy
Range("G" & i).Select 'G列Select
ActiveSheet.Paste 'Paste
SendKeys "{F8}", True 'FunctionF8 2進選択
' Qword 64bit
'SendKeys "{F8}{F2}", True 'F2 Dword 32bit
'SendKeys "{F8}{F3}", True 'F3 Word 16bit
'SendKeys "{F8}{F4}", True 'F4 Byte 8bit
SendKeys "^C", True 'Ctrl+c Copy
Range("H" & i).Select 'H列Select
ActiveSheet.Paste 'Paste
i = i + 1
Loop
'SendKeys "=", True
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
Application.ScreenUpdating = True
End Sub
Private Sub WaitTime(myTime As String)
Dim WaitTime As Variant
WaitTime = Now + TimeValue(myTime)
Application.Wait WaitTime
End Sub
<20160927追記end>
<20170122STA>
「みっちーのよろず開発日誌」様
http://dream-drive.net/archives/2011/09/excel_vba1wait.html
ありがとうございます。[メモ]Excel VBAで1秒以下のwait
VISTAにて。
Sub test004()
Application.ScreenUpdating = False
Dim ReturnValue
Dim i
ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
Call MSOWAIT("0:00:02")
AppActivate ReturnValue ' Activate the Calculator.
i = 4
'SendKeys "%VS~", True 'Alt+VでS選択 XP,VISTAの関数電卓
SendKeys "%3~", True 'Alt+3 win7のプログラマ電卓
Call MSOWAIT("0:00:01")
Do Until Range("D" & i).Value = "" ' Set up counting loop.
SendKeys "{F6}", True 'FunctionF6 10進選択
Call MSOWAIT("0:00:00.3")
Range("D" & i).Copy '対象Cell Copy
SendKeys "^V", True 'Ctrl+v Paste
'SendKeys "=", True '"="送ると-Minus消えるのでやらない
SendKeys "{F5}", True 'FunctionF5 16進選択
SendKeys "^C", True 'Ctrl+c Copy
Call MSOWAIT("0:00:00.3")
Range("G" & i).Select 'G列Select
ActiveSheet.Paste 'Paste
SendKeys "{F8}", True 'FunctionF8 2進選択
SendKeys "^C", True 'Ctrl+c Copy
Call MSOWAIT("0:00:00.3")
Range("H" & i).Select 'H列Select
ActiveSheet.Paste 'Paste
i = i + 1
Loop ' to add each value of I.
'SendKeys "=", True ' Get grand total.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
Application.ScreenUpdating = True
End Sub
Private Sub MSOWAIT(WAITms As String)
Application.WAIT Evaluate("Now() +" & """" & WAITms & """")
End Sub