Category: VB6

Subversion On Windows?!

It’s no secret that I have been contact almost daily by Technical Recruiters , often the job advertisements that the technical recruiters have been sending me include a requirement for Microsoft SourceSafe experience. I often wonder a company would choose SourceSafe to manage their code as it doesn’t really do a good job: the only go thing I guess is the integration with Visual Studio TFS.

The company I currently work for didn’t have any sort of source code management when I started. Literally, I had a budget of zero to string together something that was flexible enough and could integrate with Visual Studio 6 and Visual Studio 2005. I was able to find something that perfectly fit my needs, cost nothing other than a few hours to implement and about 1/2 an hour of research.

For the Windows server, I needed something that was mostly graphical because the other programmer basically has a fear of the change so I know he won’t be using any of the SVN commands. I also really wanted something that would use Active Directory for authentication if possiblex, because I absolutely hate having to remember yet another password that should be changed in three months. (If it uses Active Directory, I can do a Single Sign on which I believe is absolutely fantastic!) I chose to use VisualSVN Server Standard Edition because of the fairly simple graphical user interface, and Active Directory support. The only thing I’m a little disappointed about is that I have to Remote Desktop into the machine to do some remote tasks.

For the developer machines, I wanted to also have at least one graphical version for subversion. I chose to use TortoiseSVN which is absolutely fantastic and supports all of the SVN protocols that I know and also integrates very well with Windows Explorer even showing what files you have changed since you last commited!

For Visual Studio 6, I was able to use SVNVB6 which works okay but isn’t really ideal. It doesn’t really comply with any of the Microsoft Best Practices for plugins, some things aren’t really fully integrated and the project has really strange scheduled downtime each week.

For Visual Studio 2005, I wanted to be able to right click on any of the files or the project and of course be able to commit my changes. For Visual Studio 2003 + there are quite a few options, I ended up using VsTortoise but Anksvn is also a very good solution.

What Source Code Management system and plugins do you use?

Programming Excel Using Visual Basic 6

Microsoft provides the ability to programmatically created spreadsheets using Excel. The process isn’t overly complex, but the twist is that the intelisense is almost nonexistent in Visual Studio 6.0.

First we need to add a reference Microsoft Excel Object Library, on my particular Windows Computer it’s called the “Microsoft Excel 10.0 Object Library.” To be safe, we should also add the Microsoft Office Object Library; again on my particular Windows Computer it’s called “Microsoft Office 10.0 Object Library.”

We add the reference by clicking Project, and then References. Find the two object libraries mentioned and click their respective checkboxes and then click ok.

In this example, we’ll just programmatically add a couple of values to some cells, and do some basic formatting.

In the Code Window, we need to create the excel object and an excel workbook.

Dim Excl As New Excel.Application

Dim NewBook As Excel.Workbook

Dim lastRowNum as Integer ‘used to display lastRow

With Excl

Set NewBook = .Workbooks.Add

‘DisplayAlert and ScreenUpdating are two of the most useful features ‘when debugging excel, because they allow you to show excel and to hide ‘it if you don’t want the client to see if an instance of excel is running

.DisplayAlerts = False

.ScreenUpdating = False

End With

‘This next step is where we’re just going to add some data to a couple of cells

‘The format is Excel.Cells(rownumber, columnumber) . Rows and Columns ‘actually start with 1 being the first row.

With Excl

.Cells(1,1) = 5 ‘I wrote the number 5 in the first row, and first column

.Cells(1,2) = 6 ‘I wrote the number 6 in the first row, and 2nd column

.Cells(2,1) = 7 ‘I wrote the number 7 in the 2nd row, and 1st column

End With

‘Say I want to add two values using cell references

Excl.Cells(1,3). Formula = “A1+A2”

‘Let’s make the cell we just input the formula have a bold font.

‘Setting most of the front properties is as simple as selecting the cell and then ‘using .Font and finding the particular property you want to use

Excl.Cells(1,3).Font.Bold = true

‘Let’s change the Font Size to 12

Excl.Cells(1,3).Font.Size = 12

‘Saving a copy of the Excel document we have created is fairly simple

NewBook.SaveCopyAs App.Path & “test.xls”

‘Always make sure that you close the instance of Excel you opened because the ‘user will not know it is open and it can be a significant memory user.



Set NewBook = nothing

Set Excl = nothing

let me know if this was helpful!