본문 바로가기

WeekdayLife

[엑셀VBA] 버전, 언어 확인

사용중인 오피스 버전이나, 언어는 아래 코드를 통해 확인이 가능하다.

 

debug.Print application.Version
' 16.0

debug.Print Application.LanguageSettings.LanguageID(msoLanguageIDUI)
' 1033
' 1033 = English (United States)
' 1042 = Korean
' 1041 = Japanese
' 1049 = Russian
' 1036 = French
' 1031 = German
' 1034 = Spanish
' 2052 = Chinese (PRC)
' 1028 = Chinese (Taiwan)

 

 

사용중인 언어가 영어인경우, ARIAL 폰트를, 한글인 경우, 맑은 고딕 폰트를 적용하는 코드는 아래와 같다.

 

Private Sub fontset()

With ActiveWorkbook.ActiveSheet
    .Cells.Font.Size = 10
    If Application.LanguageSettings.LanguageID(msoLanguageIDUI) = 1042 Then
        .Cells.Font.Name = "맑은 고딕"
    Else
        .Cells.Font.Name = "arial"
    End If
End With

End Sub

 

끝.