|
This is definitely one of the most creative and helpful tools I've found in a long time. I noticed, though, that every time I perform a commit or diff, any .frx files show up as having changed, even if I haven't changed them (or made any changes to the entire file at all). Do you have any ideas how to fix this?
Zach
|
|
|
|
|
Sorry, there's no way to fix this as it is VBA behaviour to change a few bytes every time you export a userform to a frx (binary data in the form) file.
But as the frx file is binary anyway and therefore useless for source control, I tend to ignore it (however still put it under source control, as there are still sometimes changes to it).
-sorry, but that's it.
Roland
|
|
|
|
|
From what I have seen while working with this code, this code will be a tremendous help in updating my excel spreasheets. However, I still couldn't figure out how to compare my existing spreadsheets and the previous versions. Help! please!
|
|
|
|
|
Hi kaifu!
Thanks for the nice words, however I have to make one thing clear: Sourcetool.xla is NOT for comparing Spreadsheets, rather for comparing the VBA code modules inside Excel Workbooks.
After having said that, the following procedure can be used to compare different versions of code modules.
Go to the <projectname>.xls.src folder that was created during the initial save of the code module and put under version control using Tortoise SVN as described. Using the Tortoise SVN (version 1.5.3 and above) context menu of that folder, use "Show Log" to display all versions of the repository.
You can then use the topmost part of the log messages window to compare either the various versions with the working copy in your local checkout folder (context menu "compare with working copy") or with the respective previous version (context menu "compare with previous version").
-regards,
Roland
|
|
|
|
|
It will be very nice so that you see the svn source control status right in VBE without going to Windows Explorer.
Also inspired by Rob Bovey's CodeCleaner, I implemented an also identical program (functionality-wise) for SourceSafe using its API, but since has been looking for a way to override the icons...
Thanks,
Steven
modified on Friday, October 17, 2008 5:49 PM
|
|
|
|
|
After some research I found some more information regarding this:
Tortoise SVN has a project dedicated to icons at here: TortoiseOverlays it utilizes windows shell's internal support for icon overlays as well as windows registry to achieve this.
Through a combination of windows control API (comctl32.dll) calls (TreeView_GetImageList, ImageList_AddIcon, and ImageList_SetOverlayImage), I was able to overlay an icon image on top of a tree node within the project explorer treeview control.
|
|
|
|
|
Dear Steven!
Great! Would love to hear more about that, as I'm also trying to make the new subversion addin (also for other office VBA parts, Word, powerpoint, access...) a bit more slick.
-regards,
Roland
|
|
|
|
|
Can you show how you did this?
|
|
|
|
|
Hi, I set breakpoints to each SUB in MExportImport
when i click Save the code is never executed
when i manually start "saveto()" your code exports MExportImport, nothing more.
I set up the paths and the "security setting", do i need something else?
|
|
|
|
|
Well, which Office version/part of Office are you using it in?
-regards,
Roland
|
|
|
|
|
I'm using Excel 2003,
but now save works,
don't know why, just reinstalled your code one more time and changed nothing in the settings.
tried this several times before and did not work...
now going to test everything else..
just one last short question,
your tool also exports the workbooks als .xwk files.
since my code is jusst in a xla and not inside a workbook, can i turn this off?
|
|
|
|
|
Hi Sebastian!
Glad to hear it works now!
Concerning your question: In Module MExportImport , procedure exportComponent you can easily change the code to exclude all modules of type vbext_ct_Document :
Select Case cmpComponent.Type
Case vbext_ct_ClassModule
szFilename = szFilename & gszEXT_CLASS
Case vbext_ct_MSForm
szFilename = szFilename & gszEXT_FORM
Case vbext_ct_StdModule
szFilename = szFilename & gszEXT_MODULE
Case vbext_ct_Document
szFilename = szFilename & gszEXT_DOC
End Select
' insert following If statement...
If Not cmpComponent.Type = vbext_ct_Document Then
cmpComponent.Export wbPath & folderExtension & gszSEP & szFilename
End If
-regards,
Roland
|
|
|
|
|
I can't get it to work in office 2007. What path does it use to store the files? Where does it go in the repository?
Does it automatically create the required Directory structures? or do we have to import and create the structure in the SVN repo first?
|
|
|
|
|
Hi!
I'm not quite sure whether you're familiar with Tortoise SVN, so maybe for a first hint you might go for the Tortoise Manual.
So the first thing to do is to save the sources of the project by clicking the second button. This should create a directory called ".src" with all components of your project as text files in it (named .bas for plain modules, .cls for classes, .frm/.frx for userforms and .xwk for the Workbook's and Worksheet's code). So essentially everything you would get when exporting your components indiviually.
Then you should import BOTH the Workbook/Addin AND the .src folder into a repository of your choice (on sourceforge.net or your private/local one (that's when you need to download svn itself, in case you don't want/need a repository for yourself, forget the SVN download, Tortoise is enough).
After that, DELETE the Workbook/Addin AND the .src folder (or better, move them into a safe place, if the following checkout fails). Once you have deleted these files/folder, then CHECKOUT the files you have just imported into the folder (or any other folder, but that means you're changing the location of your addin/workbook).
Bear in mind, this is ALL still done OUTSIDE the sourcetool, using plain Tortoise functionality.
Now you're ready to use the SourceTool: Simply edit your project in the way you were used to, once finished click the commit button on the sourcetool toolbar in the VBA-IDE (button five from the left) and you'll be presented the Tortoise commit dialog, showing either
1) all the components that changed since the last update (in case you selected the project node)
2) just the component that you selected (if changed, if it's up to date, Tortoise will tell you so)
Of course I still can't tell you whether all that works in OFfice 2007, but I'd be curious if it did as I heard there were serious changes to the way you write add-ins, so my Add-in might be affected as well.
-regards,
ROland.
|
|
|
|
|
Thanks for the instructions... i figured it out after reading the posts below... this is not at all clear (the initial setup of the SVN space) from the instructions in the article. Can you update it?
Anyway thanks for the great add-in. It installed fine in 2007, and created the sources correctly. Now i've to test everything else .
Btw, couldn't you make setting up the paramters a default practice in the Install add_in event? That way whenever a user installed the add in he would have to choose the paths ...etc. But nm i guess it's not worth the extra effort.
|
|
|
|
|
I installed all the necessary components and am a bit confused on how to use this with an existing XLA file. Do I first have to export the code to a .BAS file, then import using TortoiseSVN? I can't seem to figure out a way to open and save, what less commit to the DB.
I've figured out how to use TortoiseSVN to manually manage the source code, but the interface from the VBE is not working. Whenever I open or save, I'm getting an error "couldnt determine path of project: path not found". I checked the MGLOBALS variables, and they are all changed correctly for the SubVersion and TortoiseSVN paths.
Am I missing a config param somewhere? Help would be appreciated. Thanks.
Pilotac
|
|
|
|
|
Hi Pilotac!
Sorry, I didn't mention how to do the preparation, it involves a bit of manipulation directly with TortoiseSVN. However, essentially you're right about the principle of committing the source code of a workbook/addin, although the saving is done automatically when committing to the repository.
First you export the modules with the "save" button. This creates a <yourprojectname>.xla.src folder in the same directory as your xla.
Next you import this folder into a repository already available.
The final step of the preparation is to check out the sources from the repository into the <yourprojectname>.xla.src folder back again. Don't forget to delete all the files before checking out, otherwise you will get a conflict message...
After these steps, you can simply check in and check out directly from the VBIDE.
The "couldnt determine path of project: path not found" error message you got was maybe arising from the fact that you didn't save the workbook before:
<br />
...<br />
Err.Clear<br />
wbPath = wbproj.FileName<br />
Set cmpComponents = wbproj.VBComponents<br />
<br />
If Err <> 0 Then<br />
MsgBox "couldn't determine path of project: " & Err.Description, vbCritical<br />
setwbPathAndName = False<br />
End If<br />
This part gets the path for the project and if the workbook hasn't been saved, this will fail...
-regards,
Roland
|
|
|
|
|
Bingo! That worked. Thank you! My problem was that I was going into the VBE and selecting the module, not the XLA, and for some reason that did not work.
Now that I've been dorking around with this for awhile, I need to clean out my SVN repository and setup the correct file structure. Is there a way to do that easily? Can I just delete folders in TortoiseSVN? Can I delete the whole repository and start over?
Probably a good suggestion would be to add your instructions you sent me yesterday to the Code Project page with your SourceTools.XLA instructions.
Thanks. This is a great tool. I've struggled with source code control for awhile.
Pilotac
|
|
|
|
|
Well, there is a repo broswer (I use tortoiseSVN 1.4.3), where you can delete all the files inside a repository quite easily (multi-select and context menu "delete").
I'll add the instructions when I post the new version which should work for both excel and word (using a com-addin)...
-regards,
ROland
|
|
|
|
|
Hey it would be great to use with other provider like Vault. or maybe the generic MS SCC api.. any help or pointers on doing that would be great.
Also, it would be interesting to know this kind of VBA tool could be created using VSTO.
|
|
|
|
|
Hi lex3001!
Well, it all depends on the existence of a commandline callable client (like TortoiseProc.exe in my case). I've seen that vault has a commandline client, however, as I have no experience with vault, it's up to you to decide whether vault can be used to do the three (maybe four) basic tasks of a versioning system: commit, update, revert (and maybe diff). I've seen that vault comes with a commandline client, however I'm not sure whether it can be used without some changes to my code.
I'm currently refactoring the tool to be usable also from MS Word, this means I'm rewriting it in VB6 (sorry, I'm no fan of .NET and VSTO). IN that process, I'm also planning to factor out the version tool usage into a separate class, so you should be able to "plug in" another version system as you like.
Concerning MS SCC (if you mean Visual sourcesafe), there's actually no need to develop something, as you just need to use Office developer edition. If you meant anything different, it should be possible to use such an API with the "plug in" class.
-regards,
Roland
|
|
|
|
|
Thanks Roland-
Yes, Vault has a command line tool but I think then passwords and other info needs to be cached -- maybe not a big deal. It has checkin, checkout, etc., so these command might translate to the commands in your add-in.
As for the MS SCC API -- I am actually referring to something different. This is an API that Visual Source Safe, TFS, Vault, and several other source control apps actually support/expose. You can set one source control program to tbe the "default" on your computer, and some IDEs like VB6 and VS.NET will see that default and access it through this common API (SCC provider?). I haven't been able to find much information about programming against it though. The Add-In that comes with Office XP developer edition does NOT use this commmon API, instead it interacts with VSS directly unfortunately. Some Google-ing helped me draw the conclusion that you might be able to get info on this API through the VSIP program, but most info is geared towards people writing source control programs implemented the interface as opposed to ppl writing tools or IDEs that want to call the interface.
BTW, I haven't run your add-in yet, but do you have to configure anything differently to have it show up in the Add-Ins in VBA vs. in Excel? Or does it just depend on where you choose to load the add-in?
|
|
|
|
|
|
Hi !
I didn't get the feeling that the SCC API is easy to use (NDA, not supported, etc...), so I'm very reluctant in including that myself. Maybe somebody else after I've refactored the "version client" part of SourceTools.
>>BTW, I haven't run your add-in yet, but do you have to configure anything >>differently to have it show up in the Add-Ins in VBA vs. in Excel? Or does it >>just depend on where you choose to load the add-in?
No, you (as a user of the add-in) shouldn't need to configure anything (except Tools, Macro, Security, Trusted Sources, Trust access to Visual Basic Project must be enabled), just press Alt-F11 and the menu should appear in the VBE.
-regards,
ROland
|
|
|
|
|
Hi,
I downloaded the plugin to XLStart and customized it as described. But I can't find the toolbar - I am missing something obvious?
Regards
Bobo
|
|
|
|
|