📊 VBA (Excel)
Apply Enable Win32 Long Paths (VBA)
Lifts the legacy 260-character MAX_PATH limit for apps that opt in (requires admin). Applied via WScript.Shell.RegWrite from VBA. Requires an elevated (Administrator) prompt.
EnableLongPathsRegSet.bas
Attribute VB_Name = "EnableLongPathsRegSet"
Option Explicit
Public Sub EnableLongPathsRegSet()
Dim wsh As Object
Dim regPath As String
Set wsh = CreateObject("WScript.Shell")
regPath = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled"
wsh.RegWrite regPath, 1, "REG_DWORD"
MsgBox "Enable Win32 Long Paths applied." & vbCrLf & regPath, vbInformation
End Sub