Article ID: 196197
Article Last Modified on 4/28/2004
Dim objVSSDB As VSSDatabase
Dim objVSSFile As VSSItem
Dim objSpecificVer As VSSItem
Set objVSSDB = New VSSDatabase
' Assign values to the Open method parameters.
objVSSDB.Open srcsafeini, username, password
' Sets file.txt to the object variable.
Set objVSSFile = objVSSDB.VSSItem("$/Project1/file.txt", False)
' Sets the version of file.txt associated with ProjectLabel.
Set objSpecificVer = objVSSFile.Version("ProjectLabel")
objSpecificVer.Get "c:\Project1\file.txt"
When you access objects in a Visual SourceSafe 5.0 database, you need to
add one more line of code. In the above sample, when the objSpecificVer
object is set, the .VersionNumber property contains the correct version
number of the File.txt based on the project label, assuming that a valid
label is sent to the .Version property, but it still contains an invalid
object. To work around this, add the following line of code just after you
set objSpecificVer and just before you execute the Get method. For example:
Set objSpecificVer = objSpecificVer.Version(objSpecificVer.VersionNumber)This line sets objSpecificVer explicitly by using its own .VersionNumber property, from which the .Version property successfully returns a valid object.
153925 FAQ: How can I find out if my VSS database has been upgraded?
175758 How to trap Visual SourceSafe OLE errors
Additional query words: run-time runtime
Keywords: kbautomation kbprb KB196197