본문 바로가기
카테고리 없음

폴더 찾아오기 CATIA Automation VBA

by fimm 2016. 2. 12.
CATIA Automation 작성 시 폴더를 선택하는 창을 지정할 경우가 있다.
그 창을 띄우는 코드는 아래와 같이 작성하면 쉽게 띄울 수 있다.

Private Sub CommandButtonGetPLTFolder_Click()
    Dim oShell
    Dim oFolder
    Dim oFolderItem

    On Error Resume Next
    Set oShell = CreateObject("Shell.Application")
    Set oFolder = oShell.BrowseForFolder(0, "PLT를 저장할 폴더를 선택하세요.", 0)
    If Not oFolder Is Nothing Then
        Set oFolderItem = oFolder.Items.Item
        Me.TextBoxPLTFolder.Text = oFolderItem.path
    End If

    CheckOK
End Sub


아래와 같이 폴더 지정 창을 선택 가능함