Invoice Manager For Excel Activation Key [ 100% Direct ]

'================================================================= ' PUBLIC MACROS – called from the Dashboard buttons '================================================================= Public Sub ShowInvoiceForm() frmInvoice.Show vbModal End Sub

Private Sub btnSave_Click() Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets("Invoices") '--- Basic validation ------------------------------------------------- If Trim(txtNo.Value) = "" Then MsgBox "Invoice number required.", vbExclamation Exit Sub End If '--- Compute total ---------------------------------------------------- Dim amt As Double, taxPct As Double, taxAmt As Double, total As Double amt = CDbl(Val(txtAmt.Value)) taxPct = CDbl(Val(txtTax.Value)) / 100 taxAmt = amt * taxPct total = amt + taxAmt txtTotal.Value = Format(total, "0.00") '--- Find existing row (edit) or append new ---------------------------- Dim r As Range, exists As Boolean Set r = ws.Columns("B").Find(What:=Trim(txtNo.Value), LookIn:=xlValues, LookAt:=xlWhole) If Not r Is Nothing Then exists = True Set r = r.EntireRow Else exists = False Set r = ws.Cells(ws.Rows.Count, 1).End(xlUp).Offset(1, 0) ' next empty row End If '--- Write data -------------------------------------------------------- r.Cells(1, 1).Value = IIf(IsDate(txtDate.Value), CDate(txtDate.Value

'================================================================= ' ACTIVATION KEY PROMPT '================================================================= Public Sub PromptForActivation() Dim key As String Dim ok As Boolean Do key = InputBox("Please enter your activation key to unlock the Invoice Manager:", "Activation Required") If key = vbNullString Then If MsgBox("You must provide a key to use this workbook. Close the file?", _ vbYesNo + vbQuestion, "Close?") = vbYes Then ThisWorkbook.Close SaveChanges:=False Exit Sub End If Else ok = ValidateKey(key) If ok Then Exit Do MsgBox "Invalid key – please try again.", vbExclamation, "Invalid" End If Loop 'If we got here the key is good – enable UI UnlockUI MsgBox "Welcome! The Invoice Manager is now active.", vbInformation, "Success" End Sub invoice manager for excel activation key

Private Sub btnCancel_Click() Unload Me End Sub

'================================================================= ' INITIALISATION (hide sheets, create tables if missing) '================================================================= Public Sub InitWorkbook() Dim wsInv As Worksheet, wsKey As Worksheet '--- Invoices sheet ------------------------------------------------ On Error Resume Next Set wsInv = ThisWorkbook.Worksheets("Invoices") On Error GoTo 0 If wsInv Is Nothing Then Set wsInv = ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)) wsInv.Name = "Invoices" wsInv.Range("A1:G1").Value = Array("Date", "InvoiceNo", "Customer", "Items", "Amount", "Tax", "Total") wsInv.Visible = xlSheetVeryHidden End If '--- KeyStore sheet ------------------------------------------------ On Error Resume Next Set wsKey = ThisWorkbook.Worksheets("KeyStore") On Error GoTo 0 If wsKey Is Nothing Then Set wsKey = ThisWorkbook.Worksheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)) wsKey.Name = "KeyStore" wsKey.Visible = xlSheetVeryHidden End If End Sub taxPct As Double

| Control | Name | Type / Caption | Size / Position (suggested) | |---------|---------------|----------------|-----------------------------| | Label | lblDate | Caption: “Date” | top = 10, left = 10 | | TextBox | txtDate | – | top = 10, left = 80, Width = 120 | | Label | lblNo | “Invoice #” | top = 40, left = 10 | | TextBox | txtNo | – | top = 40, left = 80 | | Label | lblCust | “Customer” | top = 70, left = 10 | | TextBox | txtCust | – | top = 70, left = 80, Width = 200 | | Label | lblItems | “Items (one per line)” | top = 100, left = 10 | | TextBox | txtItems | MultiLine = True, Height = 80 | top = 100, left = 80 | | Label | lblAmt | “Amount” | top = 190, left = 10 | | TextBox | txtAmt | – | top = 190, left = 80 | | Label | lblTax | “Tax %” | top = 220, left = 10 | | TextBox | txtTax | – | top = 220, left = 80 | | Label | lblTotal | “Total” (calculated) | top = 250, left = 10 | | TextBox | txtTotal | Locked = True | top = 250, left = 80 | | CommandButton | btnSave | Caption: “Save” | top = 290, left = 80 | | CommandButton | btnCancel | Caption: “Cancel” | top = 290, left = 180 | Option Explicit

'================================================================= ' SHA‑256 → Base64 helper (uses MSXML for crypto) '================================================================= Private Function ComputeSHA256Base64(ByVal s As String) As String Dim xml As Object Set xml = CreateObject("MSXML2.DOMDocument.6.0") Dim hashObj As Object Set hashObj = CreateObject("System.Security.Cryptography.SHA256Managed") Dim bytes() As Byte bytes = StrConv(s, vbFromUnicode) ' UTF‑8 bytes Dim hashBytes() As Byte hashBytes = hashObj.ComputeHash_2((bytes)) 'Convert to Base64 Dim base64 As Object Set base64 = CreateObject("Microsoft.XMLDOM").createElement("b") base64.DataType = "bin.base64" base64.nodeTypedValue = hashBytes ComputeSHA256Base64 = base64.Text End Function taxAmt As Double

'================================================================= ' UI UNLOCK – enables the buttons on the Dashboard sheet '================================================================= Private Sub UnlockUI() Dim ws As Worksheet Set ws = ThisWorkbook.Worksheets("Dashboard") Dim btnNew As Shape, btnSearch As Shape On Error Resume Next Set btnNew = ws.Shapes("btnNew") Set btnSearch = ws.Shapes("btnSearch") On Error GoTo 0 If Not btnNew Is Nothing Then btnNew.OnAction = "ShowInvoiceForm" If Not btnSearch Is Nothing Then btnSearch.OnAction = "ShowSearchForm" 'Optionally hide the activation prompt button (if you placed one) Dim btnActivate As Shape Set btnActivate = Nothing On Error Resume Next Set btnActivate = ws.Shapes("btnActivate") On Error GoTo 0 If Not btnActivate Is Nothing Then btnActivate.Visible = msoFalse End Sub

'================================================================= ' KEY VALIDATION (hash + lookup in KeyStore) '================================================================= Private Function ValidateKey(ByVal plainKey As String) As Boolean Dim hash As String Dim storedHash As String '1️⃣ Basic format check If Len(plainKey) <> KEY_LENGTH Then Exit Function '2️⃣ Compute hash of the key (SHA‑256) and encode as Base64 hash = ComputeSHA256Base64(plainKey) '3️⃣ Look for the hash in the KeyStore sheet Dim ws As Worksheet, rng As Range Set ws = ThisWorkbook.Worksheets("KeyStore") Set rng = ws.Range("A:A").Find(What:=hash, LookIn:=xlValues, LookAt:=xlWhole) ValidateKey = Not rng Is Nothing End Function