vba-edit


Namevba-edit JSON
Version 0.3.0 PyPI version JSON
download
home_pagehttps://github.com/markuskiller/vba-edit
SummaryEnable seamless MS Office VBA code editing in preferred editor or IDE (facilitating the use of coding assistants and version control workflows)
upload_time2025-01-19 22:51:33
maintainerNone
docs_urlNone
authorMarkus Killer
requires_python>=3.9
licenseCopyright (c) 2024, Markus Killer All rights reserved. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This project includes components from the xlwings project, which is also licensed under the BSD 3-Clause License. See LICENSES/LICENSE-xlwings.txt for the full license text.
keywords vba word pypi
VCS
bugtrack_url
requirements chardet pywin32 watchgod
Travis-CI No Travis.
coveralls test coverage No coveralls.
            vba-edit
========

Enable seamless Microsoft Office VBA code editing in your preferred
editor or IDE, facilitating the use of coding assistants and version
control workflows.

|CI| |PyPI - Version| |PyPI - Python Version| |PyPI - Downloads|
|License|

Features
--------

- Edit VBA code in your favorite code editor or IDE
- Automatically sync changes between your editor and Office applications
- Support for Word, Excel, and Access (PowerPoint support coming in
  v0.4.0)
- Preserve form layouts and module properties
- Handle different character encodings
- Integration with version control systems
- Support for UserForms and class modules

.. note::

   Inspired by code from ``xlwings vba edit``
   (`xlwings-Project <https://www.xlwings.org/>`__) under the BSD
   3-Clause License.

Quick Start
-----------

Installation
~~~~~~~~~~~~

.. code:: bash

   pip install vba-edit

Prerequisites
~~~~~~~~~~~~~

Enable "Trust access to the VBA project object model" in your Office
application's Trust Center Settings:

1. Open your Office application
2. Go to File > Options > Trust Center > Trust Center Settings
3. Select "Macro Settings"
4. Check "Trust access to the VBA project object model"

.. note::

   In MS Access, Trust Access to VBA project object model is always
   enabled if database is stored in trusted location.

Basic Usage
~~~~~~~~~~~

Excel Example
^^^^^^^^^^^^^

1. Open your Excel workbook with VBA code
2. In your terminal, run:

.. code:: bash

   excel-vba edit

3. Edit the exported .bas, .cls, or .frm files in your preferred editor
4. Changes are automatically synced back to Excel when you save

Word Example
^^^^^^^^^^^^

.. code:: bash

   # Export VBA modules from active document
   word-vba export --vba-directory ./VBA

   # Edit and sync changes automatically
   word-vba edit --vba-directory ./VBA

   # Import changes back to document
   word-vba import --vba-directory ./VBA

Access Example
^^^^^^^^^^^^^^

.. code:: bash

   # Export VBA modules
   access-vba export --vba-directory ./src

   # Import changes
   access-vba import --vba-directory ./src

Detailed Features
-----------------

Supported File Types
~~~~~~~~~~~~~~~~~~~~

- Standard Modules (.bas)
- Class Modules (.cls)
- UserForms (.frm)
- Document/Workbook Modules

Command Line Tools
~~~~~~~~~~~~~~~~~~

The package provides separate command-line tools for each Office
application:

- ``word-vba``
- ``excel-vba``
- ``access-vba``

Each tool supports three main commands:

- ``edit``: Live sync between editor and Office (Word/Excel only)
- ``export``: Export VBA modules to files
- ``import``: Import VBA modules from files
- ``check``: Check if 'Trust Access to the VBA project object model' is
  enabled

.. note::

   The command ``python -m vba_edit.utils`` can be used to troubleshoot
   Trust Access to VBA project object model, scanning and giving
   feedback on all supported MS Office apps

Common Options
~~~~~~~~~~~~~~

.. code:: text

   --file, -f             Path to Office document (optional)
   --vba-directory        Directory for VBA files
   --encoding, -e         Specify character encoding
   --detect-encoding, -d  Auto-detect encoding
   --save-headers         Save module headers separately
   --verbose, -v          Enable detailed logging
   --logfile, -l         Enable file logging

Excel-Specific Features
~~~~~~~~~~~~~~~~~~~~~~~

For Excel users who also have xlwings installed:

.. code:: bash

   excel-vba edit -x  # Use xlwings wrapper

Best Practices
--------------

1. Always backup your Office files before using vba-edit
2. Use version control (git) to track your VBA code
3. Run ``export`` after changing form layouts or module properties
4. Use ``--save-headers`` when working with UserForms
5. Consider using ``--detect-encoding`` for non-English VBA code

Known Limitations
-----------------

- Access support is limited to import/export (no live editing)
- UserForms require ``--save-headers`` option
- PowerPoint support coming in v0.4.0
- ``--in-file-headers`` option coming soon

Links
-----

- `Homepage <https://langui.ch/current-projects/vba-edit/>`__
- `Documentation <https://github.com/markuskiller/vba-edit/blob/main/README.md>`__
- `Source Code <https://github.com/markuskiller/vba-edit>`__
- `Changelog <https://github.com/markuskiller/vba-edit/blob/main/CHANGELOG.md>`__
- `Changelog of latest dev
  version <https://github.com/markuskiller/vba-edit/blob/dev/CHANGELOG.md>`__
- `Video Tutorial <https://www.youtube.com/watch?v=xoO-Fx0fTpM>`__
  (xlwings walkthrough, with similar functionality)

License
-------

BSD 3-Clause License

Acknowledgments
---------------

This project is heavily inspired by code from ``xlwings vba edit``,
maintained by the `xlwings-Project <https://www.xlwings.org/>`__ under
the BSD 3-Clause License.

.. |CI| image:: https://github.com/markuskiller/vba-edit/actions/workflows/test.yaml/badge.svg
   :target: https://github.com/markuskiller/vba-edit/actions/workflows/test.yaml
.. |PyPI - Version| image:: https://img.shields.io/pypi/v/vba-edit.svg
   :target: https://pypi.org/project/vba-edit
.. |PyPI - Python Version| image:: https://img.shields.io/pypi/pyversions/vba-edit.svg
   :target: https://pypi.org/project/vba-edit
.. |PyPI - Downloads| image:: https://img.shields.io/pypi/dm/vba-edit
   :target: https://pypi.org/project/vba-edit
.. |License| image:: https://img.shields.io/badge/License-BSD_3--Clause-blue.svg
   :target: https://opensource.org/licenses/BSD-3-Clause

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/markuskiller/vba-edit",
    "name": "vba-edit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "VBA, Word, PyPI",
    "author": "Markus Killer",
    "author_email": "Markus Killer <m.killer@langui.ch>",
    "download_url": "https://files.pythonhosted.org/packages/55/44/c0b59566aacb42d32564370abf7bdfda5034fb08eb8befb713abbe2caad8/vba_edit-0.3.0.tar.gz",
    "platform": null,
    "description": "vba-edit\n========\n\nEnable seamless Microsoft Office VBA code editing in your preferred\neditor or IDE, facilitating the use of coding assistants and version\ncontrol workflows.\n\n|CI| |PyPI - Version| |PyPI - Python Version| |PyPI - Downloads|\n|License|\n\nFeatures\n--------\n\n- Edit VBA code in your favorite code editor or IDE\n- Automatically sync changes between your editor and Office applications\n- Support for Word, Excel, and Access (PowerPoint support coming in\n  v0.4.0)\n- Preserve form layouts and module properties\n- Handle different character encodings\n- Integration with version control systems\n- Support for UserForms and class modules\n\n.. note::\n\n   Inspired by code from ``xlwings vba edit``\n   (`xlwings-Project <https://www.xlwings.org/>`__) under the BSD\n   3-Clause License.\n\nQuick Start\n-----------\n\nInstallation\n~~~~~~~~~~~~\n\n.. code:: bash\n\n   pip install vba-edit\n\nPrerequisites\n~~~~~~~~~~~~~\n\nEnable \"Trust access to the VBA project object model\" in your Office\napplication's Trust Center Settings:\n\n1. Open your Office application\n2. Go to File > Options > Trust Center > Trust Center Settings\n3. Select \"Macro Settings\"\n4. Check \"Trust access to the VBA project object model\"\n\n.. note::\n\n   In MS Access, Trust Access to VBA project object model is always\n   enabled if database is stored in trusted location.\n\nBasic Usage\n~~~~~~~~~~~\n\nExcel Example\n^^^^^^^^^^^^^\n\n1. Open your Excel workbook with VBA code\n2. In your terminal, run:\n\n.. code:: bash\n\n   excel-vba edit\n\n3. Edit the exported .bas, .cls, or .frm files in your preferred editor\n4. Changes are automatically synced back to Excel when you save\n\nWord Example\n^^^^^^^^^^^^\n\n.. code:: bash\n\n   # Export VBA modules from active document\n   word-vba export --vba-directory ./VBA\n\n   # Edit and sync changes automatically\n   word-vba edit --vba-directory ./VBA\n\n   # Import changes back to document\n   word-vba import --vba-directory ./VBA\n\nAccess Example\n^^^^^^^^^^^^^^\n\n.. code:: bash\n\n   # Export VBA modules\n   access-vba export --vba-directory ./src\n\n   # Import changes\n   access-vba import --vba-directory ./src\n\nDetailed Features\n-----------------\n\nSupported File Types\n~~~~~~~~~~~~~~~~~~~~\n\n- Standard Modules (.bas)\n- Class Modules (.cls)\n- UserForms (.frm)\n- Document/Workbook Modules\n\nCommand Line Tools\n~~~~~~~~~~~~~~~~~~\n\nThe package provides separate command-line tools for each Office\napplication:\n\n- ``word-vba``\n- ``excel-vba``\n- ``access-vba``\n\nEach tool supports three main commands:\n\n- ``edit``: Live sync between editor and Office (Word/Excel only)\n- ``export``: Export VBA modules to files\n- ``import``: Import VBA modules from files\n- ``check``: Check if 'Trust Access to the VBA project object model' is\n  enabled\n\n.. note::\n\n   The command ``python -m vba_edit.utils`` can be used to troubleshoot\n   Trust Access to VBA project object model, scanning and giving\n   feedback on all supported MS Office apps\n\nCommon Options\n~~~~~~~~~~~~~~\n\n.. code:: text\n\n   --file, -f             Path to Office document (optional)\n   --vba-directory        Directory for VBA files\n   --encoding, -e         Specify character encoding\n   --detect-encoding, -d  Auto-detect encoding\n   --save-headers         Save module headers separately\n   --verbose, -v          Enable detailed logging\n   --logfile, -l         Enable file logging\n\nExcel-Specific Features\n~~~~~~~~~~~~~~~~~~~~~~~\n\nFor Excel users who also have xlwings installed:\n\n.. code:: bash\n\n   excel-vba edit -x  # Use xlwings wrapper\n\nBest Practices\n--------------\n\n1. Always backup your Office files before using vba-edit\n2. Use version control (git) to track your VBA code\n3. Run ``export`` after changing form layouts or module properties\n4. Use ``--save-headers`` when working with UserForms\n5. Consider using ``--detect-encoding`` for non-English VBA code\n\nKnown Limitations\n-----------------\n\n- Access support is limited to import/export (no live editing)\n- UserForms require ``--save-headers`` option\n- PowerPoint support coming in v0.4.0\n- ``--in-file-headers`` option coming soon\n\nLinks\n-----\n\n- `Homepage <https://langui.ch/current-projects/vba-edit/>`__\n- `Documentation <https://github.com/markuskiller/vba-edit/blob/main/README.md>`__\n- `Source Code <https://github.com/markuskiller/vba-edit>`__\n- `Changelog <https://github.com/markuskiller/vba-edit/blob/main/CHANGELOG.md>`__\n- `Changelog of latest dev\n  version <https://github.com/markuskiller/vba-edit/blob/dev/CHANGELOG.md>`__\n- `Video Tutorial <https://www.youtube.com/watch?v=xoO-Fx0fTpM>`__\n  (xlwings walkthrough, with similar functionality)\n\nLicense\n-------\n\nBSD 3-Clause License\n\nAcknowledgments\n---------------\n\nThis project is heavily inspired by code from ``xlwings vba edit``,\nmaintained by the `xlwings-Project <https://www.xlwings.org/>`__ under\nthe BSD 3-Clause License.\n\n.. |CI| image:: https://github.com/markuskiller/vba-edit/actions/workflows/test.yaml/badge.svg\n   :target: https://github.com/markuskiller/vba-edit/actions/workflows/test.yaml\n.. |PyPI - Version| image:: https://img.shields.io/pypi/v/vba-edit.svg\n   :target: https://pypi.org/project/vba-edit\n.. |PyPI - Python Version| image:: https://img.shields.io/pypi/pyversions/vba-edit.svg\n   :target: https://pypi.org/project/vba-edit\n.. |PyPI - Downloads| image:: https://img.shields.io/pypi/dm/vba-edit\n   :target: https://pypi.org/project/vba-edit\n.. |License| image:: https://img.shields.io/badge/License-BSD_3--Clause-blue.svg\n   :target: https://opensource.org/licenses/BSD-3-Clause\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2024, Markus Killer All rights reserved.  All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  This project includes components from the xlwings project, which is also licensed under the BSD 3-Clause License. See LICENSES/LICENSE-xlwings.txt for the full license text.",
    "summary": "Enable seamless MS Office VBA code editing in preferred editor or IDE (facilitating the use of coding assistants and version control workflows)",
    "version": "0.3.0",
    "project_urls": {
        "Changelog": "https://github.com/markuskiller/vba-edit/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/markuskiller/vba-edit/blob/main/README.md",
        "Homepage": "https://langui.ch/current-projects/vba-edit/",
        "Source": "https://github.com/markuskiller/vba-edit"
    },
    "split_keywords": [
        "vba",
        " word",
        " pypi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "13d78678e9d4a8f427063065f0c3a1e1eed702bf59e653fe7cde55d7461a8a9f",
                "md5": "6845c3a779d122339ccead712ec08a37",
                "sha256": "b1d6aaa0630231c4bcb46f301c269c1064a0869af9364ff760d3245394060f21"
            },
            "downloads": -1,
            "filename": "vba_edit-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6845c3a779d122339ccead712ec08a37",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 38508,
            "upload_time": "2025-01-19T22:51:32",
            "upload_time_iso_8601": "2025-01-19T22:51:32.194543Z",
            "url": "https://files.pythonhosted.org/packages/13/d7/8678e9d4a8f427063065f0c3a1e1eed702bf59e653fe7cde55d7461a8a9f/vba_edit-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5544c0b59566aacb42d32564370abf7bdfda5034fb08eb8befb713abbe2caad8",
                "md5": "cf44f0d8205f2094ae2d544071724939",
                "sha256": "31db751c1454e32c8dae511422c49d8cb7b745304822bb294eb1e2932e726620"
            },
            "downloads": -1,
            "filename": "vba_edit-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cf44f0d8205f2094ae2d544071724939",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 42413,
            "upload_time": "2025-01-19T22:51:33",
            "upload_time_iso_8601": "2025-01-19T22:51:33.440893Z",
            "url": "https://files.pythonhosted.org/packages/55/44/c0b59566aacb42d32564370abf7bdfda5034fb08eb8befb713abbe2caad8/vba_edit-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-19 22:51:33",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "markuskiller",
    "github_project": "vba-edit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "chardet",
            "specs": []
        },
        {
            "name": "pywin32",
            "specs": [
                [
                    ">=",
                    "224"
                ]
            ]
        },
        {
            "name": "watchgod",
            "specs": []
        }
    ],
    "lcname": "vba-edit"
}
        
Elapsed time: 1.18420s