View Full Version : Solved: Run Calculator
Dear Experts
I want to activate Windows Calculator through F12.
Is it possible to run following codes when I press Function Key F12.
No matter which WorkSheet or UserForm is open.
Sub Calculator()
Dim winfolder As String
winfolder = Environ("WINDIR")
If InStr(1, Application.OperatingSystem, "NT") Then
Shell winfolder & "\system32\calc.exe", vbNormalFocus
Else
Shell winfolder & "\calc.exe", vbNormalFocus
End If
End Sub
geekgirlau
06-28-2007, 10:48 PM
Add the following to the ThisWorkbook module in PERSONAL.xls:
Private Sub Workbook_Open()
Application.OnKey "{F12}", "Calculator"
End Sub
Where is Personal.xls? and how to add module in it?
lynnnow
06-28-2007, 11:23 PM
Hi,
You have to create a workbook called personal.xls and save it in the Program Files\Microsoft Office\Office\XLSTART folder. So everytime you run an instance of Excel, the macros stored in the personal.xls file are loaded in XLS. It is the same as using a normal.dot file in Word.
You need to save an Excel file with the name Personal.xls. Then press Alt+F11 to enter the VBE and insert a module by right clicking on the personal.xls VBA project in the Project explorer window on the left. Copy paste the code geekgirl has provided and then copy the personal.xls file to the location I just specified in the previous paragraph. Close all open workbooks and run Excel again and try pressing F12.
HTH
Lynnnow
I created personal.xls to following location
C:\Program Files\Microsoft Office\OFFICE11\XLSTART
When I Press F4 in any workbook it says
The macro "c\program files\microsfot office\office11\xlstart'!calculator' cannot be found.
What is wrong?
Personal.xls is in attachment.
Please review
lucas
06-29-2007, 06:41 AM
Where is Personal.xls? and how to add module in it?
In the help file look up personal.xls. It is created the first time you record a simple macro and is a hidden file.
Format-sheet-unhide
after it's created go to the vbe and find the personal.xls in the project explorer and select it...go to insert-module on the menu bar at top.
Dear Sir,
Please do not mind.
I could not understand what you are asking for?
Please modify my attached personal.xls for understanding.
Thanks
rbrhodes
06-29-2007, 02:07 PM
Hi tqm1,
You've made a classic mistake, the name of your Module AND the name of your Sub are the same.
Change the name of the MODULE and all will be well.
Cheers,
dr
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.