Comments (5)
As a reference, this is the code that EffOff uses to achieve CustomUI injection:
string CustomUIContent = File.ReadAllText(config.CustomUI);
SpreadsheetDocument document = SpreadsheetDocument.Open(opts.target, true);
RibbonAndBackstageCustomizationsPart part = document.RibbonAndBackstageCustomizationsPart;
if (part == null)
{
part = document.AddRibbonAndBackstageCustomizationsPart();
}
part.CustomUI = new CustomUI(CustomUIContent);
part.CustomUI.Save();
document.Close();
from vba-ide-code-export.
Perhaps this idea should be canned in favor of the method presented in PR #59
from vba-ide-code-export.
One way to do this: https://github.com/byronwall/bUTL/blob/master/scripts/BuildFile.bas
I've been working on an Excel utility add-in that includes a "build from source" option to help with getting source back into git. It roughly duplicates your efforts here but includes the steps to export the Ribbon definition since it's a core part of the add-in. I took the 2nd approach listed above: extract the xlam file and dump those files somewhere. I put the files into a folder called src/package
which is then checked into git. The downside of keeping all the files is that they are user/workstation specific, so you get a number of extra diffs that aren't intended. I could probably only keep the CustomUI file, but I haven't pursued that. (The same thing happens with frx files which may not have actually changed).
There is also a script in that folder which handles the rebuilding step. It simply repackages the package
folder, opens the add-in, deletes all the existing VBA code, and then reimports the new modules from source. It could be improved, but has worked so far.
I call the Excel macros from PowerShell to give a simple command line interface instead of having to open the add-in exporter in Excel.
from vba-ide-code-export.
Awesome @byronwall! do you have to call it from PS?
from vba-ide-code-export.
No, you can make the calls from anywhere. That source code file is pulled from the VBA in build manager.xlsm
. The paths in that workbook/macro are currently relative to how the repo is setup, but those could be easily changed or made variable. Look for the spots where it says butl.xlam
, temp.zip
, src/...
, etc. That code handles both the import and export of the source code and Excel file unzipping/repackaging.
The PowerShell part of it was to avoid opening Excel to run the macros. If you're looking to integrate this into an existing Excel add-in, obviously having to open Excel is not a concern. The PowerShell file is simply starting an instance of Excel and running the macro behind the scenes. You need Excel running somewhere to get working access to the VBE commands to export the source code. You don't need VBE/Excel to unzip the Excel file or repackage it; just to get the source code extracted.
from vba-ide-code-export.
Related Issues (20)
- Tidy file structure HOT 12
- Syntax error in JSON configuration will raise an error
- Cannot run import twice in a row HOT 4
- Code "formatter" to fix whitespace issues
- Ribbon UI HOT 1
- Command line interface HOT 3
- Store Excel workbooks as Unpacked stack of XML files HOT 8
- README Improvements HOT 4
- Keep a changelog HOT 7
- Test and example workbooks HOT 4
- Build a wiki HOT 6
- Set VBAProject Name on Make Config File HOT 2
- Recommend using .gitattributes, .editorconfig and .gitignore files HOT 6
- XML to Excel
- `Add References` clearly detailed in the code HOT 1
- Deletion of macros' components after export of code HOT 6
- Installer is missing HOT 5
- File type check before Excel to XML
- Error 57101 - Can't remove default reference
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vba-ide-code-export.