timetrack-pro/rename_orphan_modules.vbs
StillHammer 7c3dd3fb31 Add VBS scripts, documentation, and HTML form templates
- Test and helper VBS scripts for VBA MCP development
- Technical reference documentation and PDFs
- HTML form templates for all 5 forms
- PowerShell and Python scripts for PDF/documentation generation

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-01-21 11:53:09 +07:00

51 lines
1.3 KiB
Plaintext

On Error Resume Next
Dim accessApp
Set accessApp = CreateObject("Access.Application")
accessApp.OpenCurrentDatabase "C:\Users\alexi\Documents\projects\timetrack-pro\db\TimeTrackPro.accdb"
WScript.Echo "=== Renaming orphan Form_* Type 1 modules ==="
Dim vbProj
Set vbProj = accessApp.VBE.VBProjects(1)
Dim modulesToRename
modulesToRename = Array("Form_frm_Accueil", "Form_frm_Clients", "Form_frm_Projets", "Form_frm_Historique")
Dim i
For i = LBound(modulesToRename) To UBound(modulesToRename)
Dim comp
Set comp = Nothing
Dim c
For Each c In vbProj.VBComponents
If c.Name = modulesToRename(i) And c.Type = 1 Then
Set comp = c
Exit For
End If
Next
If Not comp Is Nothing Then
Dim newName
newName = "OLD_" & modulesToRename(i)
WScript.Echo "Renaming: " & comp.Name & " -> " & newName
comp.Name = newName
WScript.Echo " -> Renamed!"
Else
WScript.Echo "Not found or not Type 1: " & modulesToRename(i)
End If
Next
WScript.Echo ""
WScript.Echo "=== Remaining Form_* modules ==="
For Each c In vbProj.VBComponents
If Left(c.Name, 5) = "Form_" Then
WScript.Echo c.Name & " - Type: " & c.Type
End If
Next
accessApp.CloseCurrentDatabase
accessApp.Quit
Set accessApp = Nothing