View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default How do I add a simple calculator ( Like the one found in accessori

Steve,

If you can go for a bit of VBA, use code like the following. It will open
the Windows calculator and make it a child of Excel so it will float above
the worksheets as you work in Excel and will be ready to use.

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Public Declare Function SetParent Lib "user32" ( _
ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) As Long

Sub ShowCalc()
Dim XLHwnd As Long
Dim CalcHWnd
XLHwnd = Application.Hwnd
Shell "calc.exe"
CalcHWnd = FindWindow("SciCalc", "Calculator")
If CalcHWnd 0 Then
SetParent CalcHWnd, XLHwnd
End If

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)



"Steve" wrote in message
...
How do I add a simple calculator ( Like the one found in accessories) to
my
excel spreadsheet. I am doing my personal budgets and often would like to
check how much several items will cost me but without have to go through
accessories to the calculator which disappears when I switch screens.

Is there a way to embedd one in a spread sheet?