timetrack-pro/force_delete_old.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

66 lines
1.6 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 "=== Force delete OLD_* modules ==="
Dim vbProj
Set vbProj = accessApp.VBE.VBProjects(1)
Dim toDelete
toDelete = Array("OLD_Form_frm_Accueil", "OLD_Form_frm_Clients", "OLD_Form_frm_Projets", "OLD_Form_frm_Historique")
Dim i
For i = LBound(toDelete) To UBound(toDelete)
WScript.Echo "Looking for: " & toDelete(i)
Dim found
found = False
Dim c
For Each c In vbProj.VBComponents
If c.Name = toDelete(i) Then
found = True
WScript.Echo " Found! Type: " & c.Type
' Try multiple times
Dim attempts
For attempts = 1 To 3
On Error Resume Next
vbProj.VBComponents.Remove c
If Err.Number = 0 Then
WScript.Echo " Attempt " & attempts & ": SUCCESS"
Exit For
Else
WScript.Echo " Attempt " & attempts & ": Error " & Err.Number & " - " & Err.Description
Err.Clear
End If
Next
Exit For
End If
Next
If Not found Then
WScript.Echo " Not found!"
End If
Next
WScript.Echo ""
WScript.Echo "=== All OLD modules check ==="
For Each c In vbProj.VBComponents
If Left(c.Name, 4) = "OLD_" Then
WScript.Echo "Still exists: " & c.Name
End If
Next
accessApp.CloseCurrentDatabase
accessApp.Quit
Set accessApp = Nothing
WScript.Echo "Done!"