매크로를 처음 써보는데 제가 한번 시도해볼려는게 잘안되네요.
파일명을 셋팅하고나서 파트넘버를 파일네임과 같도록 다시 셋팅합니다.
파일명은 예를들면
AB-A001-00 (assemble)
AB-W001-00 (weld)
AB-0001-00 (부품)
이렇게 구분되길래 사용사 정보에서 추가로 위의 분류에 맞도록 용접도, 조립도, 빈칸 으로
입력할려고 합니다.
구분은 파트넘버에서 불러와서 오른쪽에서 7번째문자까지 자르고 다시 왼쪽에서 1개를 따면
결과는 A, W, 0 세가지밖에 안나옴니다.
물론 A, W, 기타나머지 로 해도 문제가없네요.
이것을 아스키코드로바꾼후 그걸 if문으로 구분할려는데 안되네요.
아래 제가 매크로를 짜봤는데 비베는 잘몰라서 애먹는중입니다..
한번 봐주세요.
——————————————————————————————————————-
Public Sub CreateCustomProperties()
Dim invDoc As Document
Set invDoc = ThisApplication.ActiveDocument
Dim invPartNumberProperty As Property
Set invPartNumberProperty = invDoc.PropertySets.Item(“Design Tracking Properties”).Item(“Part Number”)
Dim invCustomPropertySet As PropertySet
Set invCustomPropertySet = invDoc.PropertySets.Item(“Inventor User Defined Properties”)
Dim strText1 As String
Dim strText2 As String
Dim strText3 As String
Dim strText As String
strText1 = “-조립도-“
strText2 = “-용접도-“
strText3 = “”
Dim invProperty As Property
If Asc(Left(Right(“invPartNumberProperty”, 7), 1)) = “65” Then Set invProperty = invCustomPropertySet.Add(strText, “strText1”)
If Asc(Left(Right(“invPartNumberProperty”, 7), 1)) = “86” Then Set invProperty = invCustomPropertySet.Add(strText, “strText2”)
If Asc(Left(Right(“invPartNumberProperty”, 7), 1)) = “48” Then Set invProperty = invCustomPropertySet.Add(strText, “strText3”)
‘End If
End Sub
어쨋든 해결했습니다 휴~ 힘드네요.