Sparky1157
Programmer
I copied the following code from a Microsoft website which demonstrates how the Calculator can be invoked from a macro:
Dim ReturnValue, I
ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
AppActivate ReturnValue ' Activate the Calculator.
For I = 1 To 100 ' Set up counting loop.
SendKeys I & "{+}", True ' Send keystrokes to Calculator
Next I ' to add each value of I.
SendKeys "=", True ' Get grand total.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
However, when running the script it errors out on line:
AppActivate ReturnValue
I tried running this under the Extra! Macro Editor and the Visual Basic 6.5 Editor - both attempts failed at the same point. I don't have enough background knowledge to know what's wrong....
Dim ReturnValue, I
ReturnValue = Shell("CALC.EXE", 1) ' Run Calculator.
AppActivate ReturnValue ' Activate the Calculator.
For I = 1 To 100 ' Set up counting loop.
SendKeys I & "{+}", True ' Send keystrokes to Calculator
Next I ' to add each value of I.
SendKeys "=", True ' Get grand total.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
However, when running the script it errors out on line:
AppActivate ReturnValue
I tried running this under the Extra! Macro Editor and the Visual Basic 6.5 Editor - both attempts failed at the same point. I don't have enough background knowledge to know what's wrong....