Messing about with Calculator...

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,254
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I have a button on a userform which simply launches the Windows Calculator exe so the user can use it to do some calculations.

When the user is done and the calculator is closed,I want the computed result on the calculator to be automatically transfered on a label located on the userform .

I know how to halt the execution of the vb code until the calculator is closed using the WaitForSingleObject function but I can't transfer the calculator result onto the userform.

Any thoughts ?.

Regards.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,300
Office Version
  1. 365
Platform
  1. Windows
Jaafar

Is this not a job for FindWindow/FindWindowEx API functions?

It's been a while since I've used them but can't you find controls/windows in application using them, as well as just applications.
 

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,254
Office Version
  1. 2016
Platform
  1. Windows
Jaafar

Is this not a job for FindWindow/FindWindowEx API functions?

It's been a while since I've used them but can't you find controls/windows in application using them, as well as just applications.

Dear Norie,

Thanks- the main obstacle is the fact that retrieving the value from the calculator can't happen until the code resumes ie: after the calculator is closed by the user.

I haven't really coded\experimented much with this yet. If anything interesting comes up, I'll post it ASAP.

again thanks.

Reagards.
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539

ADVERTISEMENT

I have been playing with this and for some reason I can only get it to return the initial value of the Calculator. I canot get it to update on the close of the calculator or as it is changed. The returnValue is not dynamic, so currently its not much good.

I think it can be made into a Class, that might do it?


Sub myCalcVal()

Set Services = GetObject("winmgmts:root\cimv2")
Set obj = Services.Get("Win32_Process")

returnValue = obj.create("calc.exe", , , returnValue)

myVal = returnValue
ActiveCell = myVal
End Sub
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
Yes, tried to work with a modification of "Krishnakumar's" link, the code does work, but does not allow for key pad input. To lend itself to direct updated from the application, we need to detect when the upper right close "X" was clicked. The "returnValue" code changes each time it is invoked and retains that value when the application is closed. Cannot detect the application's close. Tried many ways, just cannot get it to work. Something along these lines:


Sub UseCalculator()
Dim myReturnValue, myTag1
'SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.

myReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
AppActivate myReturnValue ' Activate the Calculator.
SendKeys "^c", True

myPoll:
Application.OnKey "%{F4}", "myPasteCalc"

SendKeys "^c", True
Application.Wait (Now + TimeValue("0:00:01"))
GoTo myPoll

End Sub

Sub myPasteCalc()

Application.OnKey "%{F4}"

AppActivate "Microsoft Excel"
Range("A1").Select
ActiveSheet.Paste
End Sub
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
OK, this is very unstable code but it does work, save it before you use it, it may hang!


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

Sub UseCalculator()
'Standard module code, like: Module1!
Dim myReturnValue, myTag1
Const lpClassName = "SciCalc"
Const lpCaption = "Calculator"

myReturnValue = Shell("CALC.EXE", 1)
AppActivate myReturnValue
SendKeys "^c", True

On Error GoTo myEnd

myPoll:
If FindWindow(lpClassName, vbNullString) <> 0 Or _
FindWindow(vbNullString, lpCaption) <> 0 Or _
FindWindow(lpClassName, lpCaption) <> 0 Then

SendKeys "^c", True
Application.Wait (Now + TimeValue("0:00:01"))
GoTo myPoll
Else

GoTo myEnd
End If

myEnd:
AppActivate "Microsoft Excel"
Range("A1").Select
ActiveSheet.Paste

End Sub
 
L

Legacy 98055

Guest
Hi Jaafar.

Opens calculator, removes its titlebar, makes it a child window of a userform, and therefore, offers you control over how it closes. The results of the calculator will be posted into cell a1 in the attached example.

It needs a bit more work but I am out of time. Please post any improvements that you make as I would like to see them. I could not get the LockWindowUpdate to control the screen drawing. See if you can solve that. The example works.

ShellCalcGetResults.zip

In a userform named "CustomCalc"
<table width="100%" border="1" bgcolor="White" style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#FFFFFF', gradientType='0');"><tr><TD><font size="2" face=Courier New>  <font color="#0000A0">Option</font> <font color="#0000A0">Explicit</font>

  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> GetDesktopWindow <font color="#0000A0">Lib</font> "user32" () <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> SetParent <font color="#0000A0">Lib</font> "user32" (ByVal hWndChild <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> hWndNewParent <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> MoveWindow <font color="#0000A0">Lib</font> "user32" (ByVal hwnd <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> x <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> y <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> nWidth <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> nHeight <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> bRepaint <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> FindWindow <font color="#0000A0">Lib</font> "user32" <font color="#0000A0">Alias</font> "FindWindowA" (ByVal lpClassName <font color="#0000A0">As</font> String, <font color="#0000A0">ByVal</font> lpWindowName <font color="#0000A0">As</font> String) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> SetWindowText <font color="#0000A0">Lib</font> "user32" <font color="#0000A0">Alias</font> "SetWindowTextA" (ByVal hwnd <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> lpString <font color="#0000A0">As</font> String) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> SendMessage <font color="#0000A0">Lib</font> "user32" <font color="#0000A0">Alias</font> "SendMessageA" (ByVal hwnd <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> wMsg <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> wParam <font color="#0000A0">As</font> Long, lParam <font color="#0000A0">As</font> Any) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> SetWindowLong <font color="#0000A0">Lib</font> "user32" <font color="#0000A0">Alias</font> "SetWindowLongA" (ByVal hwnd <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> nIndex <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> dwNewLong <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> SetForegroundWindow <font color="#0000A0">Lib</font> "user32" (ByVal hwnd <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> LockWindowUpdate <font color="#0000A0">Lib</font> "user32" (ByVal hwndLock <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> GetWindowLong <font color="#0000A0">Lib</font> "user32" <font color="#0000A0">Alias</font> "GetWindowLongA" (ByVal hwnd <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> nIndex <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> SetWindowPos <font color="#0000A0">Lib</font> "user32" (ByVal hwnd <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> hWndInsertAfter <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> x <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> y <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> cx <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> cy <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> wFlags <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> GetWindowRect <font color="#0000A0">Lib</font> "user32" (ByVal hwnd <font color="#0000A0">As</font> Long, lpRect <font color="#0000A0">As</font> RECT) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> FindWindowEx <font color="#0000A0">Lib</font> "user32" <font color="#0000A0">Alias</font> "FindWindowExA" (ByVal hWnd1 <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> hWnd2 <font color="#0000A0">As</font> Long, <font color="#0000A0">ByVal</font> lpsz1 <font color="#0000A0">As</font> String, <font color="#0000A0">ByVal</font> lpsz2 <font color="#0000A0">As</font> String) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> GetWindowTextLength <font color="#0000A0">Lib</font> "user32" <font color="#0000A0">Alias</font> "GetWindowTextLengthA" (ByVal hwnd <font color="#0000A0">As</font> Long) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>

  <font color="#0000A0">Private</font> <font color="#0000A0">Const</font> WM_GETTEXT = &HD
  <font color="#0000A0">Private</font> <font color="#0000A0">Const</font> WM_GETTEXTLENGTH = &HE
  <font color="#0000A0">Private</font> <font color="#0000A0">Const</font> GWL_STYLE = (-16)
  <font color="#0000A0">Private</font> <font color="#0000A0">Const</font> WS_CAPTION = &HC00000
  <font color="#0000A0">Private</font> <font color="#0000A0">Const</font> WS_MAXIMIZEBOX = &H10000
  <font color="#0000A0">Private</font> <font color="#0000A0">Const</font> WS_MINIMIZEBOX = &H20000
  <font color="#0000A0">Private</font> <font color="#0000A0">Const</font> WS_SYSMENU = &H80000
  <font color="#0000A0">Private</font> <font color="#0000A0">Const</font> WM_CLOSE = &H10

  <font color="#0000A0">Private</font> <font color="#0000A0">Enum</font> ESetWindowPosStyles
       SWP_SHOWWINDOW = &H40
       SWP_HIDEWINDOW = &H80
       SWP_FRAMECHANGED = &H20
       SWP_NOACTIVATE = &H10
       SWP_NOCOPYBITS = &H100
       SWP_NOMOVE = &H2
       SWP_NOOWNERZORDER = &H200
       SWP_NOREDRAW = &H8
       SWP_NOREPOSITION = SWP_NOOWNERZORDER
       SWP_NOSIZE = &H1
       SWP_NOZORDER = &H4
       SWP_DRAWFRAME = SWP_FRAMECHANGED
       HWND_NOTOPMOST = -2
  <font color="#0000A0">End</font> <font color="#0000A0">Enum</font>

  <font color="#0000A0">Private</font> <font color="#0000A0">Type</font> RECT
       Left <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
       Top <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
       Right <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
       Bottom <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">End</font> <font color="#0000A0">Type</font>

  <font color="#0000A0">Private</font> CalcHwnd <font color="#0000A0">As</font> Long, PID <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
  <font color="#0000A0">Private</font> pResult <font color="#0000A0">As</font> <font color="#0000A0">String</font>

  <font color="#0000A0">Private</font> <font color="#0000A0">Sub</font> UserForm_Initialize()
       <font color="#0000A0">Dim</font> UfHwnd <font color="#0000A0">As</font> Long, r(1) <font color="#0000A0">As</font> RECT, Style <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
       LockWindowUpdate GetDesktopWindow
       Shell "calc"
       CalcHwnd = FindWindow(vbNullString, "Calculator")
       GetWindowRect CalcHwnd, r(0)
       Style = GetWindowLong(CalcHwnd, GWL_STYLE)
       SetWindowText CalcHwnd, vbNullString
       Style = Style <font color="#0000A0">And</font> <font color="#0000A0">Not</font> WS_SYSMENU
       Style = Style <font color="#0000A0">And</font> <font color="#0000A0">Not</font> WS_MAXIMIZEBOX
       Style = Style <font color="#0000A0">And</font> <font color="#0000A0">Not</font> WS_MINIMIZEBOX
       Style = Style <font color="#0000A0">And</font> <font color="#0000A0">Not</font> WS_CAPTION
       SetWindowLong CalcHwnd, GWL_STYLE, Style
       UfHwnd = FindWindow(vbNullString, Me.Caption)
       SetParent CalcHwnd, UfHwnd
       MoveWindow CalcHwnd, 0, 0, r(0).Right - r(0).Left, r(0).Bottom - r(0).Top, <font color="#0000A0">True</font>
       GetWindowRect UfHwnd, r(1)
       MoveWindow UfHwnd, r(1).Left, r(1).Top, r(0).Right - r(0).Left, r(0).Bottom - r(0).Top, <font color="#0000A0">True</font>
       LockWindowUpdate <font color="#0000A0">False</font>
       Me.Repaint
  <font color="#0000A0">End</font> <font color="#0000A0">Sub</font>

  <font color="#0000A0">Friend</font> <font color="#0000A0">Property</font> <font color="#0000A0">Get</font> Result() <font color="#0000A0">As</font> <font color="#0000A0">String</font>
       Result = pResult
  <font color="#0000A0">End</font> <font color="#0000A0">Property</font>

  <font color="#0000A0">Private</font> <font color="#0000A0">Sub</font> UserForm_QueryClose(Cancel <font color="#0000A0">As</font> Integer, CloseMode <font color="#0000A0">As</font> Integer)
       <font color="#0000A0">Dim</font> EditText <font color="#0000A0">As</font> String, EditHwnd <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
       <font color="#0000A0">If</font> CloseMode = vbFormControlMenu <font color="#0000A0">Then</font>
           Cancel = <font color="#0000A0">True</font>
           EditHwnd = FindWindowEx(CalcHwnd, 0, "Edit", vbNullString)
           EditText = Space(SendMessage(EditHwnd, WM_GETTEXTLENGTH, <font color="#0000A0">ByVal</font> 0, <font color="#0000A0">ByVal</font> 0))
           SendMessage EditHwnd, WM_GETTEXT, <font color="#0000A0">ByVal</font> Len(EditText) + 1, <font color="#0000A0">ByVal</font> EditText
           pResult = EditText
           SetParent CalcHwnd, GetDesktopWindow
           SetForegroundWindow CalcHwnd
           SendMessage CalcHwnd, WM_CLOSE, 0&, 0&
           Me.Hide
       <font color="#0000A0">End</font> <font color="#0000A0">If</font>
  <font color="#0000A0">End</font> <font color="#0000A0">Sub</font>

</FONT></td></tr></table><button onclick='document.all("98200623444296").value=document.all("98200623444296").value.replace(/<br \/>\s\s/g,"");document.all("98200623444296").value=document.all("98200623444296").value.replace(/<br \/>/g,"");window.clipboardData.setData("Text",document.all("98200623444296").value);'>Copy to Clipboard</BUTTON><textarea style="position:absolute;visibility:hidden" name="98200623444296" wrap="virtual">
Option Explicit

Private Declare Function GetDesktopWindow Lib "user32" () As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private 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
Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long

Private Const WM_GETTEXT = &HD
Private Const WM_GETTEXTLENGTH = &HE
Private Const GWL_STYLE = (-16)
Private Const WS_CAPTION = &HC00000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_SYSMENU = &H80000
Private Const WM_CLOSE = &H10

Private Enum ESetWindowPosStyles
SWP_SHOWWINDOW = &H40
SWP_HIDEWINDOW = &H80
SWP_FRAMECHANGED = &H20
SWP_NOACTIVATE = &H10
SWP_NOCOPYBITS = &H100
SWP_NOMOVE = &H2
SWP_NOOWNERZORDER = &H200
SWP_NOREDRAW = &H8
SWP_NOREPOSITION = SWP_NOOWNERZORDER
SWP_NOSIZE = &H1
SWP_NOZORDER = &H4
SWP_DRAWFRAME = SWP_FRAMECHANGED
HWND_NOTOPMOST = -2
End Enum

Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private CalcHwnd As Long, PID As Long
Private pResult As String

Private Sub UserForm_Initialize()
Dim UfHwnd As Long, r(1) As RECT, Style As Long
LockWindowUpdate GetDesktopWindow
Shell "calc"
CalcHwnd = FindWindow(vbNullString, "Calculator")
GetWindowRect CalcHwnd, r(0)
Style = GetWindowLong(CalcHwnd, GWL_STYLE)
SetWindowText CalcHwnd, vbNullString
Style = Style And Not WS_SYSMENU
Style = Style And Not WS_MAXIMIZEBOX
Style = Style And Not WS_MINIMIZEBOX
Style = Style And Not WS_CAPTION
SetWindowLong CalcHwnd, GWL_STYLE, Style
UfHwnd = FindWindow(vbNullString, Me.Caption)
SetParent CalcHwnd, UfHwnd
MoveWindow CalcHwnd, 0, 0, r(0).Right - r(0).Left, r(0).Bottom - r(0).Top, True
GetWindowRect UfHwnd, r(1)
MoveWindow UfHwnd, r(1).Left, r(1).Top, r(0).Right - r(0).Left, r(0).Bottom - r(0).Top, True
LockWindowUpdate False
Me.Repaint
End Sub

Friend Property Get Result() As String
Result = pResult
End Property

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Dim EditText As String, EditHwnd As Long
If CloseMode = vbFormControlMenu Then
Cancel = True
EditHwnd = FindWindowEx(CalcHwnd, 0, "Edit", vbNullString)
EditText = Space(SendMessage(EditHwnd, WM_GETTEXTLENGTH, ByVal 0, ByVal 0))
SendMessage EditHwnd, WM_GETTEXT, ByVal Len(EditText) + 1, ByVal EditText
pResult = EditText
SetParent CalcHwnd, GetDesktopWindow
SetForegroundWindow CalcHwnd
SendMessage CalcHwnd, WM_CLOSE, 0&, 0&
Me.Hide
End If
End Sub
</textarea>

Example usage:
<table width="100%" border="1" bgcolor="White" style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#FFFFFF', gradientType='0');"><tr><TD><font size="2" face=Courier New>  <font color="#0000A0">Private</font> <font color="#0000A0">Sub</font> CommandButton1_Click()
       <font color="#0000A0">Dim</font> cc <font color="#0000A0">As</font> <font color="#0000A0">New</font> CustomCalc

       cc.Show vbModal
      <font color="#008000"> 'here is your result</font>
       Range("a1") = cc.Result

       Unload cc
       <font color="#0000A0">Set</font> cc = <font color="#0000A0">Nothing</font>
  <font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
</FONT></td></tr></table><button onclick='document.all("98200623629750").value=document.all("98200623629750").value.replace(/<br \/>\s\s/g,"");document.all("98200623629750").value=document.all("98200623629750").value.replace(/<br \/>/g,"");window.clipboardData.setData("Text",document.all("98200623629750").value);'>Copy to Clipboard</BUTTON><textarea style="position:absolute;visibility:hidden" name="98200623629750" wrap="virtual">
Private Sub CommandButton1_Click()
Dim cc As New CustomCalc

cc.Show vbModal
'here is your result
Range("a1") = cc.Result

Unload cc
Set cc = Nothing
End Sub</textarea>

ShellCalcGetResults.zip
 

Forum statistics

Threads
1,137,293
Messages
5,680,651
Members
419,923
Latest member
Kalthus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top