Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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) On Sat, 15 Aug 2009 12:21:02 -0700, oldneezer wrote: 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. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to enable Copy/Paste on protected work sheet? | New Users to Excel | |||
copy & paste numbers instead of formula | Excel Discussion (Misc queries) | |||
How to enable Copy and Paste when the sheet and workbook is protected | Excel Discussion (Misc queries) | |||
How do i copy numbers from Web and paste to excel and and get tota | Excel Worksheet Functions | |||
how can i enable or disable the paste option in excel 2000 | Excel Worksheet Functions |