-
-
Save baoo777/68ba24505b7b18f40fc1add225710cf0 to your computer and use it in GitHub Desktop.
Access Mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Compare Database | |
Option Explicit | |
Private lngSelectColumn As Long | |
Private Sub cmdCreateMail_Click() | |
Dim i As Long | |
Dim objOutlook As Outlook.Application | |
Dim objMail As Outlook.MailItem | |
Set objOutlook = New Outlook.Application | |
For i = 1 To lstMailSetting.ListCount - 1 | |
Set objMail = objOutlook.CreateItem(olMailItem) | |
objMail.BodyFormat = olFormatPlain | |
objMail.Display | |
objMail.To = lstMailSetting.Column(3, i) | |
objMail.Subject = "予測結果(" & lstMailSetting.Column(2, i) & ")を送信します" | |
objMail.Body = "Test Mail" | |
objMail.Attachments.Add "C:\Users\baoo\Desktop\csvTest.csv" | |
Next i | |
End Sub | |
Private Sub lstMailSetting_DblClick(Cancel As Integer) | |
Debug.Print lstMailSetting.ItemData(lstMailSetting.ListIndex + 1) | |
DoCmd.OpenTable "メール設定", acViewNormal, acEdit | |
DoCmd.GoToRecord acDataTable, "メール設定", acGoTo, lstMailSetting.ListIndex + 1 | |
DoCmd.GoToControl lstMailSetting.Column(lngSelectColumn, 0) | |
End Sub | |
Private Sub lstMailSetting_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) | |
Dim strCLWidth() As String | |
Dim lngWidth As Long | |
Dim i As Long | |
strCLWidth = Split(lstMailSetting.ColumnWidths, ";") | |
For i = 0 To UBound(strCLWidth) | |
lngWidth = lngWidth + strCLWidth(i) | |
If X < lngWidth Then | |
lngSelectColumn = i | |
Exit For | |
End If | |
Next i | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment