fix: address code review issues for Access support
- Fix import_vba_access() to actually save database via DoCmd.Save() - Update stale module docstring in extract_vba.py - Validate file extensions in get_file_type() instead of silently defaulting to excel - Scan both Excel/ and Access/ directories in interactive mode Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,11 +50,16 @@ def get_file_type(file_path: Path) -> str:
|
||||
|
||||
Returns:
|
||||
'access' 或 'excel'
|
||||
|
||||
Raises:
|
||||
ValueError: 不支持的文件扩展名
|
||||
"""
|
||||
ext = file_path.suffix.lower()
|
||||
if ext in ACCESS_EXTENSIONS:
|
||||
return 'access'
|
||||
return 'excel'
|
||||
if ext in EXCEL_EXTENSIONS:
|
||||
return 'excel'
|
||||
raise ValueError(f"不支持的文件类型: {ext}(支持: .xlsm, .xls, .xlsb, .accdb, .mdb)")
|
||||
|
||||
|
||||
class VBAImporter:
|
||||
@@ -411,8 +416,7 @@ class VBAImporter:
|
||||
|
||||
print("\n正在保存...")
|
||||
try:
|
||||
import time
|
||||
time.sleep(1) # 等待 VBE 完成
|
||||
access.DoCmd.Save()
|
||||
print("已保存更改。")
|
||||
except Exception as e:
|
||||
print(f"保存时出错: {e}")
|
||||
|
||||
Reference in New Issue
Block a user