バージョンの変更

'バージョン変更関数
Private Function GetNewFeatureClass(OldFeatureClass As IFeatureClass, VersionName As String) As IFeatureClass

    Dim pDataset As IDataset
    Set pDataset = OldFeatureClass
    
    Dim pWorkspace As IWorkspace
    Set pWorkspace = pDataset.Workspace
    
    Dim pVersionedWorkspace As IVersionedWorkspace
    Set pVersionedWorkspace = pWorkspace
    
    Dim pVersion As IVersion
    Set pVersion = pVersionedWorkspace
    
    Dim pNewVersion As IVersion
    Set pNewVersion = pVersionedWorkspace.FindVersion(VersionName)
    
    
    Dim pNewFeatureWorkspace As IFeatureWorkspace
    Set pNewFeatureWorkspace = pNewVersion
    
    Set GetNewFeatureClass = pNewFeatureWorkspace.OpenFeatureClass(pDataset.Name)

End Function