Solved Code Catalog for Access / VBA - Making Code Sharing Easy

I'll have to see if and how I deal with it. So far I've been able to do without it.
Comfort quickly becomes the norm. ;)


Who knows this procedure:
Initial situation: A sample file (accdb) contains the required code modules.

Now you go to your application, click on Import external data, select the sample file, go to Modules, click on the required modules and import them.
Then you realize: “The function abc is missing.”, go to the sample application, check in which module this function is located and import the module into your application.

... I didn't want that, so I created an add-in and code modules that provide information about their dependencies. :)
The next step would now be to be able to use not only my repository but also different sources.
 
Last edited:
Sorry for being thick, but we already have a Code Repository and Sample DB forum. Is the suggestion to somehow cataloged this to make it more easy to find?
 
Find and import ... the functionality of npm or nuget for Access/VBA.
 
Note:
I am also expanding my existing add-in with some features that I can also use without a "catalog".

New:
Package tag: only the content of the file is read, but it is not imported
Use tag extended: you can now directly enter a GitHub reference to a code module.

Examples:

VBA-JSON package:
XML:
<codelib>
  <package>VBA-JSON</package>
  <description>JSON conversion and parsing for VBA (https://github.com/VBA-tools/VBA-JSON)</description>
  <use>%GITHUB%:VBA-tools/VBA-JSON@master/JsonConverter.bas</use>
</codelib>

VBA-MicrosoftGraph package:
XML:
<codelib>
  <package>VBA-MicrosoftGraph</package>
  <description>VBA-MicrosoftGraph makes working with the Microsoft Graph WEB API from VBA easier. (https://github.com/mbarnesatbbs/VBA-MicrosoftGraph)</description>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/Src/AttachmentHelpers.bas</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/Src/Dictionary.cls</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/Src/Graph.bas</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/Src/TimeZoneHelpers.bas</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/Src/WebClient.cls</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/Src/WebHelpers.bas</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/Src/WebRequest.cls</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/Src/WebResponse.cls</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/authenticators/GraphAuthenticator.cls</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/authenticators/IWebAuthenticator.cls</use>
  <use>%GITHUB%:mbarnesatbbs/VBA-MicrosoftGraph@master/authenticators/OAuth2Authenticator.cls</use>
  <ref><name>MSXML2</name><major>6</major><minor>0</minor><guid>{F5078F18-C551-11D3-89B9-0000F81FE221}</guid></ref>
</codelib>
<ref>..</ref> set the reference to MSXML2.

In principle, this would make it possible to test the import of a package.
 
@Edgar_ :


I'll have to see if and how I deal with it. So far I've been able to do without it.

@Isaac:


There is no 'declarations area' in my codes. I do not declare variables in the head of a procedure, but where I need them for the first time.

@jwcolby54:


This is not hungarian notation, its the misunderstood hungarian notation.
This is worth reading: https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/


But that all are other topics and I don't want to spam the thread with off-topic. Sorry @Josef P. ;)
I used to follow Joel. That article was a bunch of foo, way too long, way too rambling. And the examples all appeared to be pointed towards C which I learned and used for a couple of year project, and later c# for another couple of year project. But none of that has the least little bit of usefulness in VBA. And apparently I'd need to memorize 1000 different prefixes for what reason?

But that has always been Joel.. JMO I simply can't care about the origins of whatever Hungarian notation was, nor what it is now. Otoh you appear to and so enjoy whatever it means to you.

As for declaring variables closest to the first usage... if your functions are so long that matters then ... hmmm... It matters to you and so...
 
I was too curious about how the technical implementation of the import could work ... =>
The package import feature is now up and running. :)

Note:
Packages can be nested, which makes it easier to organize and manage detailed components in their respective repositories.

A test package repository is available: ACLibImportWizard-Packages

Here’s how the current workflow with the Import Wizard looks in action:


Example of a nested package info:
Package for VBA-MicrosoftGraph in package repository:
Code:
<codelib>
  <package>VBA-MicrosoftGraph</package>
  <description>VBA-MicrosoftGraph makes working with the Microsoft Graph WEB API from VBA easier. (https://github.com/mbarnesatbbs/VBA-MicrosoftGraph)</description>
  <use>%GITHUB%:josef-poetzl/VBA-MicrosoftGraph@master/VBA-MicrosoftGraph.package</use>
</codelib>
.. only a reference to a package file in the VBA-MicrosoftGraph repository

Package in VBA-MicrosoftGraph repository:
Code:
<codelib>
  <package>VBA-MicrosoftGraph</package>
  <description>VBA-MicrosoftGraph makes working with the Microsoft Graph WEB API from VBA easier. (https://github.com/mbarnesatbbs/VBA-MicrosoftGraph)</description>
  <use>/Src/AttachmentHelpers.bas</use>
  <use>/Src/Dictionary.cls</use>
  <use>/Src/Graph.bas</use>
  <use>/Src/TimeZoneHelpers.bas</use>
  <use>/Src/WebClient.cls</use>
  <use>/Src/WebHelpers.bas</use>
  <use>/Src/WebRequest.cls</use>
  <use>/Src/WebResponse.cls</use>
  <use>/authenticators/GraphAuthenticator.cls</use>
  <use>/authenticators/IWebAuthenticator.cls</use>
  <use>/authenticators/OAuth2Authenticator.cls</use>
  <ref><name>MSXML2</name><major>6</major><minor>0</minor><guid>{F5078F18-C551-11D3-89B9-0000F81FE221}</guid></ref>
</codelib>
Note: I created a fork to be able to add this for the test. Ideally, the package is provided by the original author.


Not yet implemented: Catalog functionality
  • Displaying package details in a list (via WebView or subform)
  • Searching for packages
  • ...

Spotted by chance:
Tim Hall (known for VBA-JSON and more) already uses a .toml file in his repositories - including a description of the file itself.


Feedback and suggestions welcome! :)
 

Users who are viewing this thread

Back
Top Bottom