PDA

View Full Version : What determines a good code library?



Aussiebear
03-03-2006, 04:22 PM
What methods do you use to hold your code snipperts as a code library? To date, I've been saving the sample files as individual worksheet examples so that I can go back and see what has been done both on the sheet and then use VBE to see how the author has arrived at the code.

Eventually I'd like to use maybe a workbook to save similar types of code and examples to. Is this the best way?

Ted

Bob Phillips
03-03-2006, 04:56 PM
I use an Access database, which is provided with the Code Library tool that comes with Office 2000 Developer Edition. I find it suits most of my needs, but there are some shortcomings (such as an easy way to transfer from one category to another), so I am in the process of writing my own front-end to it as we speak.

Bob Phillips
03-03-2006, 04:58 PM
BTW, because it is not a module or a worksheet, it means I can hold VBA code, formulae, techniques, articles, the lot. That makes it very flexible for my purposes.

matthewspatrick
03-03-2006, 06:25 PM
I have a somewhat unorthodox way of managing my various UDFs, but it works well for me.

I created a huge add-in at work that my co-workers and our clients use, mainly to analyze data coming out of our proprietary staffing and scheduling software. This add-in includes a ton of UDFs, but the add-in does not have the UDF code.

Instead, each UDF has its own BAS file in a specified folder, and whenever someone wants to use one of the UDFs, the add-in has a routine to import the BAS file into the ActiveWorkbook's VBProject. (This way, there is never a problem handing off the workbook to someone who does not have the add-in.)

So, for UDFs at least, I have a nice folder set aside for more snippets. For other things, well, I really need a system, I guess :think:

johnske
03-03-2006, 07:01 PM
Hi Ted,

There's one in the KB here > http://www.vbaexpress.com/kb/getarticle.php?kb_id=403

Regards,
John :)

Aussiebear
03-03-2006, 09:19 PM
John,

Thank you. I will have a good look at what I can do with this.

johnske
03-03-2006, 09:32 PM
Not a prob, just use the 'Remove Module' button to take out what you don't want (they're only there as basic examples) and 'Import Module' to add any you want to save. :)

Aussiebear
03-04-2006, 03:21 AM
Do I need to have the example open at the time?

johnske
03-04-2006, 04:37 AM
To import? No, it's implicitly assumed you've already exported a copy of some modules to the desktop or a folder and you now want to save them somewhere.

Opening a workbook and extracting the modules from it via code is a different thing altogether (could be be done, but a lotta extra code just to save someone the few clicks needed to export modules to the desktop while they're already in the VBE window).

Regards,
John :)

Aussiebear
03-04-2006, 05:01 AM
John, I'm not following you at all here. Currently these excel sheets with code, reside in a sub folder (My Documents\Excel Notes). If I want to bring other examples of code into your code library what do I need to do? I have a number of these excel sheets all with a smaple of what the coder was trying to do and the accompaning code.

johnske
03-04-2006, 05:28 AM
Oh OK, I get you... A lot of the preceding discussion was about code modules, and this is for saving code modules (VBA). If you want to save spreadsheet code, just add a sheet, have both workbooks open and copy-paste (to the new sheet). :)

Aussiebear
03-04-2006, 06:35 AM
OKay will do. Since I still don't have the option to mark this topic as Solved can someone tag it for me please. Thanks to all those who offered help on this one.

Ted

malik641
03-04-2006, 11:37 AM
I use an Access database, which is provided with the Code Library tool that comes with Office 2000 Developer Edition. I find it suits most of my needs, but there are some shortcomings (such as an easy way to transfer from one category to another), so I am in the process of writing my own front-end to it as we speak.
Wow, didn't know Access did that. I need to take a few classes in Access...I'm not too familiar with it :mkay

Bob Phillips
03-04-2006, 01:05 PM
Wow, didn't know Access did that. I need to take a few classes in Access...I'm not too familiar with it :mkay

Joseph,

The Access databse is just a database, it is not an Access app, but a COM addin.

malik641
03-04-2006, 01:33 PM
Joseph,

The Access databse is just a database, it is not an Access app, but a COM addin.
Sorry Bob, I don't think I follow...


Are you saying that you are storing your code snippets (as well as other things) into a database - called Access Database (from your Office Developer edition) - that is not a .mdb file?

And I'm not so familiar with COM (and I think that's Component Object Model...right?)...so, sorry I don't follow you there either. I actually just printed some info about that which I'm going to read.

Aussiebear
03-04-2006, 02:23 PM
OK, forget my request to mark this solved... just saw a great new concept being developed with the Access direction.

BTW Can someone point out whether I'm missing something with the Thread tools re the Solved or it really is still missing as an option?

Ted

malik641
03-04-2006, 02:27 PM
BTW Can someone point out whether I'm missing something with the Thread tools re the Solved or it really is still missing as an option?

Ted
I see it there...:dunno

Bob Phillips
03-04-2006, 02:39 PM
Sorry Bob, I don't think I follow...


Are you saying that you are storing your code snippets (as well as other things) into a database - called Access Database (from your Office Developer edition) - that is not a .mdb file?

And I'm not so familiar with COM (and I think that's Component Object Model...right?)...so, sorry I don't follow you there either. I actually just printed some info about that which I'm going to read.

Joseph,

What I am saying is that the Access database is just a database. When we (most people) talk about Access, they mean the Access product, which is much more than a database, it is a GUI development tool, and a query app as well. The Code librarian just uses an Access database (for which I believe that you don't even need an Access licence), after all, even code is just data. The COM addin adds to the VBA or VB menu to give you access to that database, including update and retrieval facilities.

Because the data is stored in a simple Access databse, it is straight-forward to write your own front-end, as I am doing.

Norie
03-04-2006, 03:21 PM
xld

Can you provide a link to this add-in or must it be purchased?

I have in the past used Access as a 'repository' when creating forms etc.

malik641
03-04-2006, 03:47 PM
Bob,

Thanks for the info, much clearer now :thumb.

Bob Phillips
03-04-2006, 04:57 PM
xld

Can you provide a link to this add-in or must it be purchased?

I have in the past used Access as a 'repository' when creating forms etc.

Norie,

I am afraid that I don't have one. It is a tool that comes with Office 2000 Developer Edition, and although I have hunted high and low on t'Internet for a download, I have never found it. MS have no intention that I am aware of of developing it further, so I would have thought that they would make it generally available, but it seems not.

Actually, this would make a great subject for an open-source project. As I mentioned, I have started to develop my own front-end, but to develop it as an open-source complete tool is a great idea. Anyone else think so

mdmackillop
03-04-2006, 05:28 PM
OK, forget my request to mark this solved...

Dissolved:thumb

Aussiebear
03-04-2006, 06:21 PM
Joseph, I must be looking in the wrong place as my Thread tools only show 3 options, none of which is allowing me to mark as "solved". Can you indicate where I should be looking?

Ted

mdmackillop
03-04-2006, 06:25 PM
Hi Ted,
I'm guessing I see these with my "Approver" rights. I'm sure they'll be back again soon.
Regards
MD

malik641
03-04-2006, 11:10 PM
Joseph, I must be looking in the wrong place as my Thread tools only show 3 options, none of which is allowing me to mark as "solved". Can you indicate where I should be looking?

Ted
It's under "Admin Tools" for me...which I am seeing because of my Moderator position.

As Malcom said, I'm sure those options will be back.

Aussiebear
03-05-2006, 12:10 AM
Ahhhh.... so that the problem. I should be admin material by the year 41243.... all going well. Then I'll beam myself back in time and mark this solved.

Ted

malik641
03-05-2006, 12:31 AM
:rotlaugh:

You know, I was going to do it for you...that way you wouldn't have to go through the trouble of creating a time machine or redefining Einstein's Relativity of Time. Although if you did that, I don't think you'd worry about doing ANYTHING to this thread....but I'm getting off topic :).


I tried to mark it solved for you, and it won't let me...so I'm going to report it :thumb

Aussiebear
03-05-2006, 04:14 AM
Well its sort of solved. I was happy but then a couple of good concepts came up and Malcolm disolved it..... Good thing I can't solve a thread I'm beginnning to think

mdmackillop
03-05-2006, 05:51 AM
Hi Ted,
Here's a utility I made up a while ago (not quite 100%) It stores code in a excel file and uses a VB form to access it for pasting into Word or Excel. Extract the zip file to a suitable location and run the exe file. Enter the path in the first textbox and the codefile in the second, (that's the faulty part); then GetData. Selected code item is copied to the clipboard for pasting into the relevant application.
Maybe I've learned enough now to complete this.
Regards
MD

Aussiebear
03-06-2006, 02:44 AM
Thank you Malcolm.