Enable copy and paste numbers to and from Calculator

O

oldneezer

I was trying to use the Calculator and was surprised that I could not copy
numbers from the results of the calculator into Excel. Similarly I could not
copy numbers from my spreadsheet and paste them into the calulator. Of
course, I could have just used Excel in the first place but I did not want to
mess up any of my cells.

Actually this should be a post to the Operating System as the Calculator is
a part of it, but I could not find a place to make a suggestion for the
Operationg System - I am using Vista Home Premium. Maybe Micorosoft can fix
it for Windows 7.
--
oldneezer from Alabama

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...0-1391ea91715a&dg=microsoft.public.excel.misc
 
F

FSt1

hi
sorry to say but you can copy and paste in the windows supplied calculator.
you just can't use the mouse. you have to use the keyboard shortcut of Ctrl+
C to copy and Ctrl + V to paste. next time you'e in the calculator, on the
menu bar, click edit and you'll see the keyboard shortcuts for copy and
paste. paste wont apear until you have something on the clipboard to paste.

Regards
FSt1
 
C

Chip Pearson

You can use CTRL+C to copy the contents of the Calculator's result
window to the clipboard, and CTRL+V to paste the clipboard into the
result window.

In the interest of science, if you want to do this programmatically,
you can use:

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (
_
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias
"FindWindowExA" ( _
ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, _
ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA"
( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) As Long


Sub CalcResultToCell()
Dim CalcHWnd As Long
Dim CalcEdit As Long
Dim S As String
Dim L As Long
Dim DataObj As New MSForms.DataObject
Const WM_COPY = &H301
Const CF_TEXT = 1
Const EM_SETSEL = &HB1
CalcHWnd = FindWindow(vbNullString, "Calculator")
If CalcHWnd = 0 Then
MsgBox "Can't find Calculator"
Exit Sub
End If
CalcEdit = FindWindowEx(CalcHWnd, 0&, "Edit", vbNullString)
If CalcEdit = 0 Then
MsgBox "Can't find Edit window"
Exit Sub
End If
L = SendMessage(CalcEdit, EM_SETSEL, 0&, 255&)
L = SendMessage(CalcEdit, WM_COPY, 0&, 0&)
' at this point, the contents of the calculator window are in the
clipboard.
' the next lines take it off the clipboard and put it into
variable S and
' then S into A1.
DataObj.GetFromClipboard
S = DataObj.GetText
Range("A1").Value = S

End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top