セルの範囲にある複数の受信者の電子メールを追加しようとしています。
シートでメールの範囲を選択できます。
ただし、この不一致エラーが発生し続け、解決方法がわかりません。
私は解決策を探し回っていて、同じ手順を実行しました。
私を許してください、私はVBAが初めてです。大変お世話になりました。私のコードは以下のとおりです。
Private Sub CommandButton1_Click()
Dim olapp As Object
Dim olmail As Object
Dim recip As String
lastr = ThisWorkbook.Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
'this is for the range of data to be copied on the body but have yet to do it
lastr2 = ThisWorkbook.Sheets("Sheet1").Cells(Rows.Count, 7).End(xlUp).Row
recip = ThisWorkbook.Sheets("Sheet1").Range("G3:G" & lastr2).Value
'mismatch after this step
Set olapp = CreateObject("Outlook.Application")
Set olmail = olapp.CreateItem(0)
With MItem
.to = recip
.Subject = "hello"
.Body = "whats up"
.display
End With
なぜこれが起こっているのですか?