vba [vba] Outlook 현재 활성화된 창의 제목 및 내용을 가져오는 방법
페이지 정보
본문
VBA |
Sub progrgram1472() Dim myOlExp As Outlook.Explorer Dim myOlSel As Outlook.Selection Set myOlExp = Application.ActiveExplorer Set myOlSel = myOlExp.Selection Dim selectedFolder As Outlook.MAPIFolder Set selectedFolder = myOlExp.CurrentFolder Dim itemMessage As String itemMessage = "Item is unknown." Dim expMessage As String expMessage = "Your current folder is " & selectedFolder.Parent.Name & " - " & selectedFolder.Name & "." & vbCrLf If myOlSel.Count > 0 Then Dim selObject As Object Set selObject = myOlSel.Item(1) If (TypeOf selObject Is Outlook.mailItem) Then Dim mailItem As Outlook.mailItem Set mailItem = selObject itemMessage = "The item is an e-mail message." & " The subject is " & mailItem.Subject & "." itemMessage = itemMessage & vbCrLf itemMessage = itemMessage & mailItem.Body 'mailItem.Display (False) ElseIf (TypeOf selObject Is Outlook.contactItem) Then Dim contactItem As Outlook.contactItem Set contactItem = selObject itemMessage = "The item is a contact." & " The full name is " & contactItem.Subject & "." 'contactItem.Display (False) ElseIf (TypeOf selObject Is Outlook.AppointmentItem) Then Dim apptItem As Outlook.AppointmentItem Set apptItem = selObject itemMessage = "The item is an appointment." & apptItem.Subject & "." ElseIf (TypeOf selObject Is Outlook.taskItem) Then Dim taskItem As Outlook.taskItem Set taskItem = selObject itemMessage = "The item is a task." & " The body is " & taskItem.Body & "." ElseIf (TypeOf selObject Is Outlook.meetingItem) Then Dim meetingItem As Outlook.meetingItem Set meetingItem = selObject itemMessage = "The item is a meeting item. " & "The subject is " & meetingItem.Subject & "." End If End If expMessage = expMessage & itemMessage MsgBox (expMessage) End Sub |
- 다음글[vba] 가위, 바위, 보 게임 22.10.16
댓글목록
등록된 댓글이 없습니다.