hello i have developed code but it shows a run time error can some one please advise whats is the issue
Private Sub CommandButton1_Click()
Range("A2").Select
While Not ActiveCell = ""
Mail_To = ActiveCell.Offset(0, 0)
Mail_Subject = "testing"
Mail_Voting = ActiveCell.Offset(0, 4)
Set myolapp = CreateObject("Outlook.Application")
Set myitem = myolapp.CreateItem(olMailItem) ---> error in this line "Method 'Subject' of object'_Mailitem' failed
With myitem
.VotingOptions = Mail_Voting
.To = Mail_To
.Subject = ActiveCell.Offset(0, 1)
.Body = ActiveCell.Offset(0, 2)
.display
End With
ActiveCell.Offset(1, 0).Select
Wend
End Sub
Private Sub CommandButton1_Click()
Range("A2").Select
While Not ActiveCell = ""
Mail_To = ActiveCell.Offset(0, 0)
Mail_Subject = "testing"
Mail_Voting = ActiveCell.Offset(0, 4)
Set myolapp = CreateObject("Outlook.Application")
Set myitem = myolapp.CreateItem(olMailItem) ---> error in this line "Method 'Subject' of object'_Mailitem' failed
With myitem
.VotingOptions = Mail_Voting
.To = Mail_To
.Subject = ActiveCell.Offset(0, 1)
.Body = ActiveCell.Offset(0, 2)
.display
End With
ActiveCell.Offset(1, 0).Select
Wend
End Sub