Conversion showcase: CONVOD.bas helpers
These examples show how the VBAtoPython converter handles real world utility functions from CONVOD.bas. The Python shown is syntactically valid and representative of the cleaned drafts the engine produces; complex projects may still need light manual review.
QBColorName – from legacy colors to clean Python
Original VBA
' QBColorName: map QBColor index to a friendly name
Public Function QBColorName(I As Integer) As String
Select Case I
Case 0: QBColorName = "Black"
Case 1: QBColorName = "Blue"
Case 2: QBColorName = "Green"
Case 3: QBColorName = "Cyan"
Case 4: QBColorName = "Red"
Case 5: QBColorName = "Magenta"
Case 6: QBColorName = "Yellow"
Case 7: QBColorName = "White"
Case 8: QBColorName = "Gray"
Case 9: QBColorName = "Light Blue"
Case 10: QBColorName = "Light Green"
Case 11: QBColorName = "Light Cyan"
Case 12: QBColorName = "Light Red"
Case 13: QBColorName = "Light Magenta"
Case 14: QBColorName = "Light Yellow"
Case 15: QBColorName = "Bright White"
Case Else: QBColorName = "Unknown"
End Select
End FunctionPython Output
def qb_color_name(i: int) -> str:
"""Map QBColor index to a friendly name."""
# Select Case rewritten as a dictionary lookup
# for cleaner, more pythonic logic.
colors = {
0: "Black",
1: "Blue",
2: "Green",
3: "Cyan",
4: "Red",
5: "Magenta",
6: "Yellow",
7: "White",
8: "Gray",
9: "Light Blue",
10: "Light Green",
11: "Light Cyan",
12: "Light Red",
13: "Light Magenta",
14: "Light Yellow",
15: "Bright White",
}
return colors.get(i, "Unknown")Have a similar module?
Run your own files through the converter to see how it handles your specific logic patterns.