Can't figure out how to eliminate file-spec prefix on my VBA macro

Copper Contributor

A lifetime ago I wrote assembler, C, and C++ but was not a VB developer. Being a small business owner now (and with Covid19 giving me downtime) I thought I'd try to automate a few things and found my way to VBA and macros.

I use Office365 and I've cobbled together a function that I will use literally hundreds of times - it simply sums numbers below itself while the background color is that same as it's own. It also draws borders around the column of cells as a visual confirmation of how it worked.

 

I put my VBA function, =sltcSumColor(), into an otherwise empty spreadsheet, put it on a common drive, and then pointed to it in the File|Options|Add-ins section. That all worked, until I had another user test it... it turns out each usage of the function now has a file-spec in front of it, including my name. My function correctly shows up in the Add-in list, and if they delete the long pathname prefix, the function does work, but when I opened it later I found the full pathnames were back, but this time with the name of the testing user...
='C:\Users\Gord\Dropbox\Seabbatical\IT Dept\Office\sltc VBA code.xlam'!sltcSumColor()

 

I poked around and see information on Personal.xlsb and XLSTART, and compiling, TypeScript, JavaScript, and VSTO - but I feel like I'm going in circles. How do I properly make my function so 2 people can use it, then eventually email it to the customer?

 

I've attached a cut-back version of the spreadsheet and I believe the VBA code is included too. Cell D5 is how it should look for all users, and D11 is what it looked like after I got it back from Gord. 

 

Note: I attempted many variations to put a double-underline on the cell that holds the sum, but never could get it to work and gave up (but pieces of that code are still in there because I thought someday I'd try again).

 

If anybody has any guidance for me it would be much appreciated.

Thanks in advance,
Dan.

2 Replies

@Jan Karel Pieterse 

Jan, thanks for the link to the article, it was helpful.

If I understood my options correctly, I decided to not use the Add-in concept and instead copied the VBA code for the function into each spreadsheet that uses it and turned on password protection, so at least users and the eventual customer can use it with having to do anything.

That would make a database developer shake his head because now I'll have a maintenance issue going forward.