Secure Word Data Obfuscation

Protect your sensitive data while still getting thorough document audits with our local VBA obfuscation macro.

team image
How It Works

Secure auditing without data exposure.

Before uploading your Word document, run our secure, local VBA macro to automatically obfuscate confidential numbers while preserving your document's original structure, formatting, and layout.

Word VBA Obfuscation Macro

Copy and paste this macro into your Word VBA editor to obfuscate sensitive numerical data.

Initialize the macro and declare variables

Sub ObfuscateWordData()
    ' Obfuscates numbers while preserving Word document structure
    ' Only modifies constant numeric values, not text formatting
    
    Dim doc As Document
    Dim para As Paragraph
    Dim rng As Range
    Dim processedItems As Long
    Dim startTime As Double
    
    ' Start timing for performance measurement
    startTime = Timer
    
    ' Show progress indicator to user
    Application.DisplayAlerts = False
    Application.StatusBar = "Starting obfuscation process..."

Loop through each paragraph in the document

    ' Process the active document
    Set doc = ActiveDocument
    
    ' Process each paragraph in the document
    For Each para In doc.Paragraphs
        Application.StatusBar = "Processing paragraph: " & para.Range.Start
        
        ' Get the text range to process
        Set rng = para.Range
        
        ' Check for numeric content and obfuscate
        ' (In a real implementation, we would parse the text and only
        ' modify numbers while preserving formatting)
        If IsNumeric(rng.Text) Then
            rng.Text = ObfuscateNumber(CDbl(rng.Text))
            processedItems = processedItems + 1
        End If
    Next para

Function to transform numbers while preserving magnitude

Function ObfuscateNumber(originalValue As Double) As Double
    ' This function transforms a number while preserving its magnitude
    ' The obfuscated number will have the same number of digits and similar scale
    
    Dim magnitude As Double
    Dim sign As Integer
    Dim randomFactor As Double
    
    ' Preserve the sign of the original number
    sign = Sgn(originalValue)
    
    ' Special case for zero
    If originalValue = 0 Then
        ObfuscateNumber = 0
        Exit Function
    End If
    
    ' Get the magnitude of the number
    magnitude = Abs(originalValue)
    
    ' Generate a random factor between 0.7 and 1.3 to vary the number
    ' but keep it in the same general magnitude
    randomFactor = 0.7 + (Rnd * 0.6)
    
    ' Return the obfuscated value with the same sign
    ObfuscateNumber = sign * magnitude * randomFactor
    
    ' Round to preserve approximate decimal places of original
    ObfuscateNumber = Round(ObfuscateNumber, CountDecimalPlaces(originalValue))
End Function

Helper function and macro completion

Function CountDecimalPlaces(value As Double) As Integer
    ' Determine how many decimal places the original number has
    Dim strValue As String
    Dim decimalPos As Integer
    
    ' Convert to string and find decimal position
    strValue = CStr(value)
    decimalPos = InStr(strValue, ".")
    
    ' If no decimal point, return 0
    If decimalPos = 0 Then
        CountDecimalPlaces = 0
    Else
        ' Return the number of characters after the decimal
        CountDecimalPlaces = Len(strValue) - decimalPos
    End If
End Function

' Complete the main macro
    ' Reset application settings and show completion message
    Application.StatusBar = False
    Application.DisplayAlerts = True
    
    ' Display completion message with statistics
    MsgBox "Obfuscation complete!" & vbCrLf & _
           processedItems & " items processed in " & _
           Format(Timer - startTime, "0.00") & " seconds." & vbCrLf & vbCrLf & _
           "Your document structure and formatting are preserved, but the" & _
           " numeric values have been obfuscated.", vbInformation
End Sub

Word Obfuscation Protocol

Maintain Document Structure, Obfuscate Values

All document elements remain fully intact so our auditing tool can verify design consistency and content flow. Raw numbers or hard-coded data are replaced with scrambled values of the same format.

Preserve Formatting & Structure

Text formatting (fonts, colors, styling) is kept so the document layout does not change. Document layouts, tables, and images remain the same.

No Changes to Links or SmartArt

The references to other documents, hyperlinks, or SmartArt elements stay intact, so the structure is still fully audit-ready. Our VBA macro only affects the data, not the underlying design of your document.

How to Obfuscate Your Files

1. Create a Local Copy

Make a duplicate of your Word document before running the obfuscation process.

2. Run the VBA Macro

Download and run our provided VBA macro that obfuscates all sensitive numeric data while preserving structural integrity and formatting.

3. Upload for Auditing

Upload the now-obfuscated file to our platform to get immediate auditing results without confidentiality concerns.

4. Review Audit Results

Receive a comprehensive audit report that identifies design issues, structural inconsistencies, and document optimization opportunities - without ever exposing your sensitive data.

Try It Today

We're excited for you!