Try this
Code:
Private Declare Function GetSystemPowerStatus Lib "kernel32" (lpSystemPowerStatus As _
SYSTEM_POWER_STATUS) As Long

Private Type SYSTEM_POWER_STATUS
        ACLineStatus As Byte
        BatteryFlag As Byte
        BatteryLifePercent As Byte
        Reserved1 As Byte
        BatteryLifeTime As Long
        BatteryFullLifeTime As Long
End Type

Private Sub Command1_Click()
Dim MyStatus As SYSTEM_POWER_STATUS
Dim MyLifeTime As Double
GetSystemPowerStatus MyStatus
MyLifeTime = MyStatus.BatteryLifeTime
If MyLifeTime = -1 Then
    MsgBox "Using AC Power"
Else
    MsgBox "I have " & MyLifeTime / 3600 & " hours remaining on battery."
End If
End Sub