📊 VBA (Excel)

Check Enable Win32 Long Paths Registry Value (VBA)

Reads the Enable Win32 Long Paths registry value via WScript.Shell.RegRead and reports it in a message box — no PowerShell or reg.exe needed.

By WindowsScripting.com · 632 B
EnableLongPathsRegCheck.bas
Attribute VB_Name = "EnableLongPathsRegCheck"
Option Explicit

Public Sub EnableLongPathsRegCheck()
    Dim wsh As Object
    Dim regPath As String
    Dim value As Variant

    Set wsh = CreateObject("WScript.Shell")
    regPath = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled"

    On Error Resume Next
    value = wsh.RegRead(regPath)
    On Error GoTo 0

    If IsEmpty(value) Then
        MsgBox "Value not set:" & vbCrLf & regPath, vbExclamation, "Enable Win32 Long Paths"
    Else
        MsgBox "Enable Win32 Long Paths" & vbCrLf & regPath & " = " & value, vbInformation
    End If
End Sub