• This repository has been archived on 01/Sep/2022
  • Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language VBA
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Export & Import VBA code for use with Git (or any VCS)

VBA IDE CodeExport

The MIT License Gitter

Average time to resolve an issue Percentage of issues still open

Stories in Ready Code Triagers Badge

Intro

Export your excel VBA project source code for use with Git (or any VCS) from the Excel Developer ribbon, a pure VBA add-in for code export, no need to install a COM add-in

Use this add-in so that all the associated VBA files used in a VBA project (*.cls, *.bas, *.frm files) can be effortlessly exported for use with a Version Control System.

Got code in your Worksheet and ThisWorkbook modules? No problem! CodeExport takes care of those too, exporting them as *.sht and *.wbk files 👍

This is specifically for Excel, although the VBIDE extensibility can be used for all the MS Office suite.

Installing

  1. Download the add-in installer (e.g. CodeExport_setup_1.2.3.exe)
  2. Run the installer and follow the prompts.
  3. In Excel, Check the Trust access to the VBA project model check box located in Trust Centre -> Trust Centre Settings -> Macro Settings -> Trust access to the VBA project model.

Usage

After installing the add-in you will have the buttons for CodeExport in the Excel Developer ribbon. The add-in will also create a menu in the VBA IDE (the VBE) called Export for VCS. All controls for the add-in are found in these menus.

The configuration file

A file named CodeExport.config.json in the same directory as an Excel file declares what gets imported into and exported from that Excel file. The Make Config File button will create or update the configuration file automatically based on the current contents of the active Excel file. The configuration file can also be edited by hand in a text editor. This allows you to make further adjustments that the Make Config File button cannot do.

The configuration file is a plain text file using the JSON file format. Here is an example:

{
    "VBAProject Name": "MyAwesomeProgram",
    "Base Path": "src",
    "Module Paths": {
        "Sheet1": "Sheet1.cls",
        "ThisWorkbook": "ThisWorkbook.cls",
        "Module1": "Module1.bas",
        "Class1": "my\\sub\\dir\\Class1.bas",
        "Userform1": "C:\\my\\absolute\\path\\Userform1.frx"
    },
    "References": [
		{
			"Name": "Scripting",
			"Description": "Microsoft Scripting Runtime",
			"GUID": "{420B2830-E718-11CF-893D-00A0C9054228}",
			"Major": 1,
			"Minor": 0
		}
    ]
}

Another example can be found in the comprehensive example project.

Here is what each configuration property declares:

  • VBAProject Name - The name of the VBAProject. Will be set on import. Must not contain any spaces.
  • Module Paths - A file system path for every module that will be imported and exported by CodeExport. These may be relative or absolute paths.
  • Base Path - A prefix to be prepended to all relative paths in Module Paths.
  • References - A list of reference definitions. Each reference described will be referenced on import and dereferenced on export.

Importing & Exporting

The Import button will:

  • Import all the modules specified in the Module Paths configuration property. Existing modules in the Excel file will be overwritten.
  • Add all library references declared in the References configuration property. Existing library references in the Excel file will be overwritten.
  • Set the VBAProject name as declared in the VBAProject Name configuration property.

The Export button will:

  • Export all the modules specified in the Module Paths configuration property. Existing files in the file system will be overwritten.
  • Dereference libraries declared in the References configuration property.

Build from source

Clone the repo

Clone the repo git clone https://github.com/spences10/VBA-IDE-Code-Export, navigate to where you have cloned the code to, there you will find the src/VBA-IDE-Code-Export.package folder. This is the 'unpacked' version of the VBA-IDE-Code-Export Excel .xlsm binary (workbook).

Build the binary

To "repack" the binary, create an empty .zip file and name it VBA-IDE-Code-Export. Open the empty .zip file then drag and drop the contents of the VBA-IDE-Code-Export.package folder into the .zip file.

Now [I'm assuming you're using Windows] if you have the Folder Options setting for Hide extensions for known file types checked then this is the time to uncheck it.

Rename the file extension on the newly created VBA-IDE-Code-Export.zip file from .zip to .xlsm. Acknowledge the dialog saying if you change the extension bad things might happen and you will have "packed" the binary, ready to add the VBA code to.

Add the code

The VBA code and related information can be imported using an already installed copy of CodeExport, or it can be done manually.

All the necessary configuration for CodeExport to build itself is already prepared in src/CodeExport.config.json. To perform the build:

  1. Make sure you have a recent release of CodeExport installed. Instructions for installation can be found in the Installing section.
  2. Open the VBA-IDE-Code-Export.xlsm template binary.
  3. Use the CodeExport Import button to automatically import everything that is required. Since two versions of CodeExport is open at once, there will be two identical sets of buttons in the developer ribbon menu, and this can be confusing. Only one of these sets of buttons will work. If in doubt, use the menu available in the VBE, where there will only be one menu (for now).

If the automated method is not possible, everything can be done manually. The best way to do this is to have the VBA-IDE-Code-Export.xlsm VBA IDE open in one window then the file explorer open at the src folder in another window.

Multi select the contents of the folder excluding VBA-IDE-Code-Export.package and CodeExport.config.json drag and drop into the VBA-IDE-Code-Export.xlsm VBA IDE.

Add in the following references:

  1. Microsoft Scripting Runtime
  2. Microsoft Visual Basic for Applications Extensibility 5.3
  3. Windows Script Host Object Model
  4. Microsoft Shell Controls And Automation

Set the VBAProject name to CodeExport.

Save, Debug>Compile the project then from the Immediate pane in the VBA IDE enter auto_open and hit return this should create the VBA IDE menu items, you're ready to move onto usage.

Build the installer

Instructions for building the installer (e.g. CodeExport_setup_1.2.3.exe) can be found at doc/installer-build-instructions.md.

Contributing

Please fork this repository and contribute back using GitHub pull requests.

Any contributions, large or small, major features, bugfixes, integration tests and unit tests are welcomed and appreciated but will be thoroughly reviewed and discussed.

Roadmap

  • Add pretty ribbon UI
  • Export XL as XML
  • Import XL from XML
  • Command line interface

More Repositories

1

twitter-bot-bootstrap

Twitter bot bootstrap 👢 using node and twit 🐦
JavaScript
234
star
2

cheat-sheets

Cheat Sheets 🐭🤖👀
Svelte
228
star
3

sveltekit-embed

SvelteKit embed components
TypeScript
203
star
4

sveltekit-mdsvex-starter-blog

A Markdown blog built with SvelteKit, MDSveX, Tailwind CSS and DaisyUI
Svelte
79
star
5

sveltekit-theme-switch-example

Demo app using theme-change in SvelteKit with Tailwind and DaisyUI
Svelte
69
star
6

svead

Svead 🍺, a component that allows you to set head meta information, canonical, title, Twitter and Facebook Open Graph tags, and schema.org data.
Svelte
67
star
7

twitter-bot-playground

Want to build your own twitter bot 🐣 check out the documentation.
JavaScript
62
star
8

vscode-vba

VBA syntax highlighting and snippets for use in VSCode
TypeScript
52
star
9

pacellman

Pac-Man in Excel
VBA
48
star
10

scottspence.com

My blog made with SvelteKit and MDSveX
Svelte
47
star
11

sveltekit-vendure-commerce

SvelteKit and Vendure Commerce example 🤝
Svelte
39
star
12

VBA-Coding-Standards

VBA Code Guidelines
35
star
13

react-seo-component

A React SEO component
TypeScript
33
star
14

cv

My online CV using Svelte
Svelte
33
star
15

settings

Settings, for when things die and you can't quite remember how things were 🙃
JavaScript
20
star
16

thelocalhost

Modern web development guides hints and tips.
JavaScript
19
star
17

scottspence.me

Personal portfolio built with Gatsby
JavaScript
17
star
18

blog.scottspence.me

My personal blog made with Gatsbyjs
JavaScript
15
star
19

sveltekit-reactions

🎉 An emoji reactions component to use on your site
Svelte
14
star
20

last.scottspence.com

My Letter Beautiful Mysterious Notebook.
HTML
13
star
21

sparkles-blog

Svelte
13
star
22

gatsby-starter-chakra-ui

The Gatsby default starter using chakra UI
JavaScript
13
star
23

graphcms-sveltekit-portfolio-and-blog-starter

A SvelteKit portfolio and blog starter with GraphCMS
Svelte
12
star
24

vba-snippets

VBA code snippets for Microsoft VSCode.
11
star
25

dotfiles

dot files and configurations 💠🗃
JavaScript
11
star
26

sveltekit-starter-blog

Svelte
9
star
27

sveltekit-and-airtable-contact-form-example

SvelteKit form submission example with Airtable
Svelte
9
star
28

sveltekit-with-urql

An example of using URQL with SvelteKit
Svelte
8
star
29

sveltekit-authentication-cookies

TypeScript
7
star
30

sveltekit-short-urls

Short URLs with SvelteKit
TypeScript
6
star
31

sveltekit-with-auth0

SvelteKit with Auth0 example from Chris Ellis' blog
JavaScript
6
star
32

sveltekit-graphcms-starter-blog

SvelteKit starter blog with GraphCMS
Svelte
6
star
33

sveltekit-contact-form-example

Contact form example with SvelteKit using nodemailer
Svelte
6
star
34

react-tic-tac-toe

React Tic Tac Toe
JavaScript
5
star
35

gradient-animation-example

Gradient text animation example with Tailwind CSS and daisyUI in SvelteKit
JavaScript
5
star
36

kitql-with-sveltekit-and-graphcms

Svelte
4
star
37

sveltekit-data-loading-examples

TypeScript
4
star
38

tech-twitter-irl

JavaScript
4
star
39

sveltekit-auth

JavaScript
4
star
40

vscode-vba-icons

Simple VBA IDE icons theme for VSCode
4
star
41

kitql-with-graphcms

TypeScript
4
star
42

developer-hub-crm

TypeScript
4
star
43

github-user-information

Serverless function to display GitHub user information as images
TypeScript
4
star
44

og-image-gen

Open Graph Image Gen with SvelteKit and Satori
TypeScript
3
star
45

svelteflix

Example SvelteKit project from the Frontend Masters workshop with Rich Harris
Svelte
3
star
46

nextjs-mdx-landing-page

JavaScript
3
star
47

hackernews-react-apollo

Graphcool Hackernews clone in React with Apollo
JavaScript
3
star
48

VBA-Import-Eport-to-SQL-Server

Excel with validation for a SQL server backend
PLpgSQL
3
star
49

sveltekit-env-example

TypeScript
3
star
50

urql-with-sveltekit-and-graphcms

Svelte
3
star
51

gatsby-starter-styled-components

JavaScript
3
star
52

vba-custom-calendar-control

vba-custom-calendar-control
Visual Basic
3
star
53

svelte-pod

RSS podcast player
Svelte
2
star
54

JavaScript30

Learn the new hotness with @WesBos and JavaScript30, these are my follow along files
HTML
2
star
55

html-all-the-things

A recreation of the HTML All The Things website using SvelteKit and GraphCMS
Svelte
2
star
56

sveltekit-local-fonts

Using local fonts with Tailwind in a SvelteKit project
JavaScript
2
star
57

find-tech-conferences

An open source directory of global tech conferences
Svelte
2
star
58

httpcodes-dev

A searchable list off HTTP codes with details
TypeScript
2
star
59

burnt.scottspence.com

My personal site built with Toast, Tailwind and MDX.
HTML
2
star
60

load-markdown-via-endpoint

TypeScript
2
star
61

javascript-stack-boilerplate

JavaScript stack boilerplate 🍳👨‍🍳
JavaScript
2
star
62

dang-thats-delicious

Learn node coursework 👀:squirrel:
JavaScript
2
star
63

table-of-contents-example-gatsby-and-mdx

Example of smooth scroll in Gatsby with a Table of Contents component
JavaScript
2
star
64

night-fever

JavaScript
2
star
65

insta-styled

🤳 Instagram filters list from https://github.com/picturepan2/instagram.css in a SvelteKit page
CSS
2
star
66

sveltekit-slides

Svelte
2
star
67

github-user-repos

Vercel serverless function to get GitHub user repos
TypeScript
2
star
68

now-short-urls

Short URLs for Vercel's Now.sh
2
star
69

sveltekit-and-turso-analytics

🧐 Roll your own analytics with SvelteKit and Turso
TypeScript
2
star
70

robots-txt-syntax-highlighting

robots.txt syntax highlighting for VS Code
2
star
71

personal-goals

Personal goals for accountability!
2
star
72

autohotkey

AutoHotkey
2
star
73

hacker-nuxt

Simple hackernews clone in nuxt
Vue
1
star
74

sveltest

TypeScript
1
star
75

gatsby-netlify-cms

CSS
1
star
76

slidev-theme-dark-night-owl

CSS
1
star
77

twitter-bot-twit

Basic Twitter bot for my likes and retweets, uses the `twit` npm package
JavaScript
1
star
78

svelte-quiz

Svelte Quiz app using the Open Trivia Database
Svelte
1
star
79

graphql-request-with-sveltekit-and-graphcms

Svelte
1
star
80

houdini-with-sveltekit-example

Example of using Houdini with SvelteKit
JavaScript
1
star
81

gatsby-eats-apis

Slides for API Days London talk - November 14th 2019
JavaScript
1
star
82

generate-og-image

TypeScript
1
star
83

c-counter

Cryptocurrency ticker with Svelte
Svelte
1
star
84

gatsby-wordpress-example

JavaScript
1
star
85

framework-of-the-day

Get your fresh JavaScript frameworks here!
JavaScript
1
star
86

gatsby-starter-file-system-route-api-mdx

MDX
1
star
87

actions-deploy-to-vercel

TypeScript
1
star
88

svelte-actions-demo

Svelte
1
star
89

sveltekit-ui

Svelte
1
star
90

shiki-magic-move-svelte

TypeScript
1
star
91

markdown-showdown

JavaScript
1
star
92

jobba-jobba-jobba

HTML
1
star
93

jamstack-conf-workshop-2021

Building with SvelteKit and GraphQL workshop - Jamstack Conf 2021
Svelte
1
star
94

positivity-api

Positive quotes
JavaScript
1
star
95

fcc-example-mar-22-my-developer-portfolio

My developer portfolio built with SvelteKit and GraphCMS
Svelte
1
star
96

blog-name-generator

JavaScript
1
star
97

characters-from-password

Pick characters from password
Svelte
1
star
98

pomodoro

Svelte
1
star
99

sveltekit-skeleton

JavaScript
1
star
100

sveltekit-and-fathom

Add Fathom analytics to your SvelteKit site!
Svelte
1
star