Skip to content

ychsieh95/Python-VBA-Writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

VBA Macro Writer

A basic VBA macro writer with Python.

Requirements

  • Python 3+

  • Python package: pywin32

    $ pip3 install pywin32

Usage

from vba_macro_writer import VbaMacroWriter


INPUT_FILE   = 'The ABSOLITE file path of input xlsm file'
STARTUP_MACRO = 'The VBA startup macro'
MODULE_MACRO  = 'The VBA module macro'


if __name__ == '__main__':
    m_writer = VbaWriter(INPUT_FILE)
    if not m_writer.check_reg_accessable():
        m_writer.write_reg_accessable()
    m_writer.open_file()
    m_writer.write_macro_workbook_from_text(STARTUP_MACRO)
    m_writer.write_macro_module_from_text(MODULE_MACRO)
    m_writer.save_file()

References

About

A class of VBA macro writer with Python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages