The following demonstrates how to use VBA Excel macro language to download random data from SwiftRNG Entropy Server when used with 32 bit Microsoft Excel. Before using the following examples, make sure the SwiftRNG Entropy Server device is running.

A sample source code that retrieves a random VBA Integer from SwiftRNG Entropy Server and insterts that value into A1 cell of the Excel Sheet

' Include the exact path to SwiftRNG-32.dll which is available with the software kit.
' Make sure that the SwiftRNG Entropy Server is running
Declare Function getRandomByte Lib "C:\tools\windows-binaries\windows-x86\SwiftRNG-32.dll" _
        Alias "getEntropyAsByte" () As Integer
        
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
    ByRef Destination As Any, _
    ByRef Source As Any, _
    ByVal Length As Long)
    
    Private Function getRandomInteger() As Integer
        Dim RandomBytes(1 To 2) As Byte
        Dim i As Integer
        Dim rndInteger As Integer
        Dim rndByte As Integer
        
        For i = 1 To LenB(rndInteger)
            rndByte = getRandomByte()
            If rndByte > 255 Then
                Err.Raise Number:=1, Description:="Could not retrieve random Integer from SwiftRNG Entropy Server"
            Else
                RandomBytes(i) = rndByte
            End If
        Next

        CopyMemory rndInteger, RandomBytes(1), LenB(rndInteger)
        getRandomInteger = rndInteger
    End Function

Sub Macro1()
    Dim rndInteger As Integer
    rndInteger = getRandomInteger()
    [A1].Value = rndInteger
End Sub

A sample source code that retrieves a random VBA Double from SwiftRNG Entropy Server and insterts that value into A1 cell of the Excel Sheet

' Include the exact path to SwiftRNG-32.dll which is available with the software kit.
' Make sure that the SwiftRNG Entropy Server is running
Declare Function getRandomByte Lib "C:\tools\windows-binaries\windows-x86\SwiftRNG-32.dll" _
        Alias "getEntropyAsByte" () As Integer
        
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" ( _
    ByRef Destination As Any, _
    ByRef Source As Any, _
    ByVal Length As Long)
    
    Private Function getRandomDouble() As Double
        Dim RandomBytes(1 To 8) As Byte
        Dim i As Integer
        Dim d As Double
        Dim rndByte As Integer
        
        For i = 1 To 8
            rndByte = getRandomByte()
            If rndByte > 255 Then
                Err.Raise Number:=1, Description:="Could not retrieve random double from SwiftRNG entropy server"
            Else
                RandomBytes(i) = rndByte
            End If
        Next

        CopyMemory d, RandomBytes(1), LenB(d)
        getRandomDouble = d
    End Function

Sub Macro1()
    Dim randomDouble As Double
    randomDouble = getRandomDouble()
    [A1].Value = randomDouble
End Sub