ƒƒ“ƒ|ƒCƒ“ƒg |
[VBA]Access‚©‚çOutLook‚ðƒRƒ“ƒgƒ[ƒ‹‚·‚é [“®ìŠÂ‹«] Microsoft Windows 2000 [ŠT—v]Access‚̃tƒH[ƒ€ã‚©‚çOutLook‚ð‹N“®‚µAƒ[ƒ‹‚Ì‘—ŽóM‚Ȃǂ̃Rƒ“ƒgƒ[ƒ‹‚ªs‚¦‚Ü‚·B‚È‚¨‚±‚±‚ÅЉ‚é‚Ì‚ÍAOutLook‚Ì‘—MƒgƒŒƒC‚Öƒ[ƒ‹‚ð‘—‚é•û–@‚ÆAŽóMƒgƒŒƒC‚ÌV’…ƒ[ƒ‹‚ðŠm”F‚·‚é•û–@‚Å‚·BŽÀÛ‚É‘—ŽóM‚·‚é‚É‚ÍOutLook‘¤‚Å‚Ì’èŠú“I‚È‘—ŽóM‚È‚Ç‚Ìݒ肪•K—v‚É‚È‚è‚Ü‚·B [Žè‡]1: •Ï”錾Access‚ÅV‹KƒtƒH[ƒ€‚ð쬂µAƒ‚ƒWƒ…[ƒ‹ƒŒƒxƒ‹‚ʼnº‹L‚̃R[ƒh‚ð‹Lq‚µ‚ĉº‚³‚¢B Dim m_OLApp As Object Dim m_Namespace As Object Dim m_Folder As Object Dim m_Item As Object Dim m_RecvItem As Object 2F OutLook‹N“®Access‚̃tƒH[ƒ€ƒI[ƒvƒ“‚̃Cƒxƒ“ƒgƒvƒƒV[ƒWƒƒ‚ɉº‹L‚̃R[ƒh‚ð‹Lq‚µ‚ĉº‚³‚¢B 'outlook‚Ì‹N“® Set m_OLApp = CreateObject("Outlook.Application") Set m_Namespace = m_OLApp.GetNamespace("MAPI") Set m_Folder = m_Namespace.GetDefaultFolder(6) m_Folder.Display 3F ‘—MƒgƒŒƒC‚Ƀ[ƒ‹‚ð‘—‚éƒtƒH[ƒ€ã‚ɃRƒ}ƒ“ƒhƒ{ƒ^ƒ“‚ð쬂µAƒNƒŠƒbƒN‚̃Cƒxƒ“ƒgƒvƒƒV[ƒWƒƒ‚ɉº‹L‚̃R[ƒh‚ð‹Lq‚µ‚ĉº‚³‚¢B 'ƒ[ƒ‹ì¬ Set l_Item = m_OLApp.CreateItem(olMailItem) l_Item.To = "xxx@xxx.xx.xx" '‘—MæƒAƒhƒŒƒX l_Item.Subject = "ƒeƒXƒg" 'Œ–¼ l_Item.Body = "‘—‚ê‚Ü‚µ‚½‚©H" '–{•¶ l_Item.send ‚Ü‚½ l_Item.send ‚Ì‘O‚É l_Item.Display ‚ƉÁ‚¦‚é‚ƃ[ƒ‹V‹K쬃_ƒCƒAƒƒO‚ªŒ»‚ê‚Ü‚·B 4F ŽóMƒgƒŒƒC‚̃[ƒ‹‚ðŒ©‚éƒRƒ}ƒ“ƒhƒ{ƒ^ƒ“‚ð쬂µAƒNƒŠƒbƒNƒCƒxƒ“ƒgƒvƒƒV[ƒWƒƒ‚ɉº‹L‚̃R[ƒh‚ð‹Lq‚µ‚ĉº‚³‚¢B Dim l_unread As Integer '–¢ŠJ••” Dim l_cnt As Integer '‘SŽóMƒ[ƒ‹” Dim m As Integer 'ƒJƒEƒ“ƒg—pƒ[ƒ‹‘” Dim i As Integer '–¢“ǃ[ƒ‹ƒJƒEƒ“ƒg—p l_unread = m_Folder.UnReadItemCount '–¢ŠJ••ƒ[ƒ‹” l_cnt = m_Folder.Items.Count 'ƒ[ƒ‹‘” If l_unread <> 0 Then '–¢“ǃ[ƒ‹‚ª‚ ‚é‚Æ‚« ReDim act(l_unread) As Variant 'ˆ¶æ ReDim frm(l_unread) As Variant '‘—MŽÒƒAƒhƒŒƒX ReDim sday(l_unread) As Variant 'ƒ[ƒ‹‘—M“úŽž ReDim rday(l_unread) As Variant 'ƒ[ƒ‹ŽóM“úŽž ReDim sbj(l_unread) As Variant 'ƒ[ƒ‹ƒ^ƒCƒgƒ‹ ReDim msg(l_unread) As Variant 'ƒ[ƒ‹–{•¶ i = 1 '–¢“ǃ[ƒ‹‰Šú’l 'ƒ[ƒ‹‚ðˆêŒ–Ú‚©‚猩‚Ä‚¢‚ For m = 1 To l_cnt Set m_Item = m_Folder.Items(m) 'ƒ[ƒ‹ŠJ‚ If m_Item.unread = True Then '–¢ŠJ••‚̃[ƒ‹‚¾‚¯‚ðŠJ‚ act(i) = m_Item.To'ˆ¶æ Set m_RecvItem = m_Item.Reply 'ˆê“x•ÔM‚µ‚ăAƒhƒŒƒX‚ðŽæ‚èo‚·B frm(i) = m_RecvItem.Recipients(1).address 'ƒ[ƒ‹‘—MŽÒƒAƒhƒŒƒX sday(i) = m_Item.senton 'ƒ[ƒ‹‘—M“úŽž rday(i) = m_Item.ReceivedTime 'ƒ[ƒ‹ŽóM“úŽž sbj(i) = m_Item.Subject 'ƒ[ƒ‹ƒTƒuƒWƒFƒNƒg msg(i) = m_Item.Body 'ƒ[ƒ‹–{•¶ 'ƒ[ƒ‹‚ðŠJ••‚·‚é (‚±‚̈—‚ð‚µ‚È‚¢‚ÆA 'ƒf[ƒ^‚ðŽæ‚èo‚µ‚Ä‚à–¢“Çó‘Ô‚Ì‚Ü‚Ü‚É‚È‚é) m_Folder.Items(m).unread = False MsgBox "ˆ¶æ:" & act(i) & vbNewLine & _ "‘—MŽÒƒAƒhƒŒƒX:" & frm(i) & vbNewLine & _ "‘—M“úŽž:" & sday(i) & vbNewLine & _ "ŽóM“úŽž:" & rday(i) & vbNewLine & _ "ƒTƒuƒWƒFƒNƒg:" & sbj(i) & vbNewLine & _ "–{•¶:" & msg(i) i = i + 1 End If Next End If ‚Ü‚¸Aƒ[ƒ‹‘”i–¢“Ç{Šù“Çj‚Æ–¢“ǃ[ƒ‹Œ”‚ðŽæ“¾‚µ‚Ü‚·B–¢“ǃ[ƒ‹”•ª‚Ì•Ï”‚ð’è‹`‚µ‚ÄA‘Sƒ[ƒ‹‚ðŠù“ÇE–¢“Ç‚Å”»’f‚µA–¢“Ç‚Å‚ ‚ê‚΂»‚Ì“à—e‚ð•Ï”‚ɃZƒbƒg‚µ‚Ä‚¢‚«‚Ü‚·B 5F OutLook‚ÌI—¹ƒtƒH[ƒ€‚̃Nƒ[ƒYƒCƒxƒ“ƒgƒvƒƒV[ƒWƒƒ‚ɉº‹L‚̃R[ƒh‚ð‹Lq‚µ‚ĉº‚³‚¢B 'outlook‚ÌI—¹ m_OLApp.Quit 'ƒIƒuƒWƒFƒNƒg‚ÌŠJ•ú Set m_OLApp = Nothing Set m_Namespace = Nothing Set m_Folder = Nothing Set m_Item = Nothing @ |
|