DEV Community

Cover image for To VBA and beyond - building a RESTful backend using plain Microsoft Excel macros

To VBA and beyond - building a RESTful backend using plain Microsoft Excel macros

Michael Neu on October 07, 2017

When my coworkers and I discussed backend technologies for an upcoming project, someone jokingly mentioned Excel as people widely misused it as a t...
Collapse
 
blonkm profile image
Michiel van der Blonk

This may not be ideal but if you call DoEvents in VBA your user interface will not be blocked. Though keeping a macro running indefinitely may be a bad idea.

Collapse
 
michaelneu profile image
Michael Neu

I haven't seen DoEvents, yet. I just added it and now the GUI isn't blocking anymore, thus you could kill the server from the VBA window, too. Thank you!

Collapse
 
jrohatiner profile image
Judith

Awesome project! have you tried it with any other libraries like maybe Angular?

Collapse
 
michaelneu profile image
Michael Neu

I haven't tried Angular in particular yet, but since the FileSystemWebController can serve any static file, I'm pretty confident it should work for pre-built Angular projects, Elm, Vue, Ember.js or any other framework, too. I mainly choose React because I didn't want to build the proof of concept in the example folder before running webxcel and Angular seemed a bit overkill for such a small demo.

Getting the angular-cli's webpack-dev-server running with webxcel is somewhat different though, but it should work nevertheless (the worst case I could imagine is proxying both servers with nginx, but that's a non-issue as well).

Collapse
 
ben profile image
Ben Halpern

This is very cool Michael.

Collapse
 
michaelneu profile image
Michael Neu

Thank you :)

Collapse
 
rossbates profile image
Ross Bates

Just want to second what Ben said. What a cool project!

Thread Thread
 
michaelneu profile image
Michael Neu

Thanks!

Collapse
 
scoobyq profile image
ScoobyQ • Edited

Hi, I was hoping you might cover re-using the "tcp connection" as you would with a Session object in other languages e.g. Python. I was looking for a VBA way of issuing multiple xhr requests and having the efficiency of using the underlying tcp connection. Is this possible with your method? Thank you.

Collapse
 
uk92712260 profile image
uk

It's really great and it's exactly what I was looking for but: I can't get it to work.
I used the example. I started the webxel.xlsm. I opened the index.html in Firefox.
Now I can enter some ToDos but how is the connection to the server?
What am I doing wrong??

Confused: Ulrich

Collapse
 
janke0909 profile image
JanKe0909

Hey Mike, this is so awesome. Cant believe it, a dream comes true. Virtual hugs, Jan