|
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
|
|
|
|
|
Hi Bobo!
Well, did you look in the VBA IDE (Alt-F11)? In case you did, which version of Excel are you using? In case you have downloaded the codecleaner, the technique is the same here, so if you get the toolbar in codecleaner then you should also get it here.
--regards,
Roland
|
|
|
|
|
Installed the CodeCleaner. It said that the Tools, Macro, Security, Trusted Sources, Trust access to Visual Basic Project must be enabled. Then it worked and I got the toolbar!
Having worked a bit with it I must say that it is a good tool that I will be able to use in the future. Not beeing a Tortoise expert it took me some time to figure out that you have to enable revisioning on the project before the plugin works. I also expected to the Revert button to cancel in memory edits but I could see no changes after Reverting??
I have not found any comnmercial tools that does this. Do you have any idea what it would take to enable it for WOrd, Access etc.?
Rgds
Bobo
|
|
|
|
|
OK, sorry for the terse description, I assumed a typical/advanced subversion user as the target audience. I will amend the documentation accordingly.
Concerning the revert button, it does actually revert in memory edits. The only issue here is that it doesn't revert to the saved module, but rather to the stored version in the repository. To just revert to the saved module, you need to use the save/load button (first two buttons), however you don't have version control here.
Enabling for Word, Access etc., requires a generalization of the code to use the object models of those applications, where I have some hope for Word and Powerpoint, as these use a very similar object model (in terms of accessing the VBproject) as Excel, but less hope for Access, which uses saveAsText and loadFromText and references code modules completely different from the other MS apps.
-regards,
Roland
|
|
|
|
|
I know this is an old post but thought it best to say im running this in Excel 2013 - to get the menu to display open the Class Modules - CmenuHandler and remove the reference to VBIDE from VBIDE.CommandBarEvents
Save and restart
|
|
|
|
|