Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding labels using VBA

Status
Not open for further replies.

jschaddock

Programmer
Oct 19, 2001
38
GB
Hi, I've added this to the VBA forum too incase anyone can help.

I've got an excel spreadsheet which links up to Visual Sourcesafe and prints out the name of objects, the version, comments, labels etc... We link to VSS using the SourceSafeTypeLib object and the connection works fine for reading data from VSS. The objects we have in VSS are SQL server object scripts such as tables, views, stored procedures etc.
However, I am now trying to get the code to add a label to an object version depending on what the comments are i.e. we have a number of objects with comments that read "2.5 upgrade" and I would like to add a label with "2.5" to each version of each object with this comment. We currently do not use labelling and this exercise is designed to try and add labels without having to trawl through all the objects (mostly stored procedures) and add the labels manually. Not good practice to not use labelling from the beginning I know, but it's what we were given by the vendor and we're only now getting some time to try and sort this out.

To add the label I'm trying to use the code:

Dim oItem As SourceSafeTypeLib.VSSItem
Dim oVersion As SourceSafeTypeLib.VSSVersion

For Each oVersion In oItem.Versions
If InStr(oVersion.Comment, wsDB.Range("G1").Value2) > 0 Then
oVersion.VSSItem.Label ("Label 2.5")
End If
Next oVersion

When running this I get:

Run-time error '-2147166149(8004d83b)':

File XXX is already open

Does this mean that I can't update the file because my connection is locking it?
I'm not really a VBA programmer so I'm a little stumped, any help would be much appreciated.

Thanks
J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top