xlstoxlsm_vba.py
import win32com.client as win32
import win32api
import xlwings as xw
def main():
# Excel 앱을 시작
app = xw.App(visible=False)
try:
workbook = app.books.open(FILE_BEFORE)
workbook.save(FILE_AFTER)
print(f"파일이 성공적으로 '{FILE_AFTER}'로 저장되었습니다.")
except Exception as e:
print(f"오류 발생: {e}")
finally:
# 파일 닫기 및 앱 종료
workbook.close()
app.quit()
# 완료 메시지
win32api.MessageBox(0, "작업을 완료했습니다.", "작업 완료", 0)
if __name__ == "__main__":
FILE_BEFORE = "vba.xls" # 원본
FILE_AFTER = "vba.xlsm" # 대상
main()
'컴퓨터 > Python' 카테고리의 다른 글
python 클립보드에서 엑셀파일 붙여넣기 win32 (0) | 2024.11.29 |
---|---|
python xlsx→xls xlsx→xlsm 파일 변환 (0) | 2024.11.05 |
python 엑셀투파이썬 판다스 pivot_table 03countifsumif_chatgpt_skiprow.py xls xlsx xlsm 파일 읽고 저장 (0) | 2024.11.04 |
python xls 파일 병합셀 해제 최종 (0) | 2024.11.02 |
python win32com.client xlsx 확장자 파일을 xls,xlsm 확장자 파일로 바꾸기 (0) | 2024.10.30 |