1. Make a backup of your workbook.
2. Open your workbook and ALT+F11
3. Locate your Workbook name in Project Explorer Window
4. Right click on your workbook name > Insert > Module
5. Copy paste the Macro code given and change the bold lines as per your requirement
6. Go back to your Workbook and ALT+F8 to display Macro Window
7. Run your Macro from here
8. Delete you Macro if the Macro was needed to be run only once.
9. Otherwise save your file as .xlsm if you intend to reuse Macro again.
'**** Vijay A. Verma (eforexcel.com) ***** Sub GetBatteryChargingStatus() Dim ChargeRemaining As Long Dim Obj As Object For Each Obj In GetObject("winmgmts:").InstancesOf("Win32_Battery") ChargeRemaining = Obj.EstimatedChargeRemaining Next Obj MsgBox "Battery Charging Remaining : " & ChargeRemaining & "%" End Sub