Skip to content

Commit

Permalink
fixed script to update the template correctly / updated template
Browse files Browse the repository at this point in the history
  • Loading branch information
fzumstein committed Nov 10, 2015
1 parent c092121 commit 722e10d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions scripts/update_vba_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
# under Options > Trust Center > Trust Center Settings > Macro Settings (in the case of Excel 2010)

import os
from xlwings import Workbook
from xlwings import Workbook, FileFormat

this_dir = os.path.dirname(os.path.abspath(__file__))

# Template
workbook_paths = [os.path.abspath(os.path.join(this_dir, os.pardir, 'xlwings', 'xlwings_template.xltm'))]
template_path = os.path.abspath(os.path.join(this_dir, os.pardir, 'xlwings', 'xlwings_template.xltm'))
workbook_paths = [template_path]

# Examples
root = os.path.abspath(os.path.join(this_dir, os.pardir, 'examples'))
Expand All @@ -22,7 +23,13 @@
wb = Workbook(path)
wb.xl_workbook.VBProject.VBComponents.Remove(wb.xl_workbook.VBProject.VBComponents("xlwings"))
wb.xl_workbook.VBProject.VBComponents.Import(os.path.abspath(os.path.join(this_dir, os.pardir, 'xlwings', 'xlwings.bas')))
wb.save()
if 'xlwings_template' in wb.fullname:
# TODO: implement FileFormat in xlwings
wb.xl_workbook.Application.DisplayAlerts = False
wb.xl_workbook.SaveAs(template_path, FileFormat=FileFormat.xlOpenXMLTemplateMacroEnabled)
wb.xl_workbook.Application.DisplayAlerts = True
else:
wb.save()
wb.close()


Expand Down
Binary file modified xlwings/xlwings_template.xltm
Binary file not shown.

0 comments on commit 722e10d

Please sign in to comment.