컴퓨터/엑셀

아웃룩을 이용하여 엑셀에서 이메일보내기-VBA 분석

풍경소리^^ 2019. 1. 13. 08:54

https://www.youtube.com/watch?v=TSg6tx35mH0

Private Sub Workbook_Open()

    

    '//Get Settings

    With Sheets("Settings") '환경설정 시트 이름

        

        MAIL_CONTENTS_SHEET = .Range("B4").Value '메일내용 시트 이름

        MAIL_LIST_SHEET = .Range("B5").Value '메일수신자목록 시트 이름

        

        SUBSTITUTE_VALUE_START = "B" '대체값 지정 시작열

        SUBSTITUTE_VALUE_END = .Range("B6").Value "대체값 지정 끝열

        ATTACH_FOLDER_START = .Range("B7").Value '첨부파일 위치 지정 시작열

        ATTACH_FOLDER_END = .Range("B8").Value '첨부파일 위치 지정 끝열

    

    End With

    

    Call listFonts

    

    

End Sub

========== ========== ========== ========== ========== ========== 

Sub listFonts()

 

Dim wd As Object

Dim fontID As Variant

Dim i As Integer

    

On Error GoTo ErrHandler

 

    Set wd = CreateObject("Word.Application")

 

    '//font type combo

    For Each fontID In wd.FontNames

        Sheets(MAIL_CONTENTS_SHEET).cbxFontLists.AddItem fontID

    Next

    

    '//font size combo

    For i = 6 To 50

        Sheets(MAIL_CONTENTS_SHEET).cbxFontSize.AddItem i

    Next i

    

    wd.Quit

    Set wd = Nothing

    

 

NormalEnd:

 

Exit Sub

 

 

ErrHandler:

 

    If Err.Number <> 0 Then

        MsgBox "작업 중 에러가 발생했습니다. 아래의 메시지를 확인하십시오." & vbNewLine & vbNewLine & "Error code : " & Err.Number & vbNewLine & Err.Description

    End If

    

    Resume NormalEnd

  

End Sub

 

 

'컴퓨터 > 엑셀' 카테고리의 다른 글

free icons  (0) 2019.01.13
ui  (0) 2019.01.13
엑셀이 읽기전용으로 열려요  (0) 2019.01.12
엑셀 단축키-황재욱(인용)  (0) 2018.12.28
ByVal, ByRef  (0) 2018.10.24