I've created an outlook e-mail using olcreatitem, and put addresses into it using the .to .cc and .bcc variables, but i cant work out how to add new addresses to the list after the e-mail has been created. The code i've used is:
Private Sub createmail()
On Error GoTo continue
MESSAGE.To = MESSAGE.To + tovar
MESSAGE.CC = MESSAGE.CC + ccvar
MESSAGE.BCC = MESSAGE.BCC + bccvar
MESSAGE.Display
Set MESSAGE = Nothing
Set OUTAPP = Nothing
Exit Sub
continue:
createnewmail
End Sub
Private Sub createnewmail()
Err.Clear
Set MESSAGE = OUTAPP.CreateItem(olMailItem)
createmail
End Sub
I thought that by not setting the variable initially, and waiting for an error to occur (the error being that the email hasnt been created) that if the email "MESSAGE" already existed, that outlook would re-use it rather than creating a new instance, but it doesnt seem to work. OUTAPP and MESSAGE are both defined as public variables in the declarations section.
Someone please help!!
Thanks
Private Sub createmail()
On Error GoTo continue
MESSAGE.To = MESSAGE.To + tovar
MESSAGE.CC = MESSAGE.CC + ccvar
MESSAGE.BCC = MESSAGE.BCC + bccvar
MESSAGE.Display
Set MESSAGE = Nothing
Set OUTAPP = Nothing
Exit Sub
continue:
createnewmail
End Sub
Private Sub createnewmail()
Err.Clear
Set MESSAGE = OUTAPP.CreateItem(olMailItem)
createmail
End Sub
I thought that by not setting the variable initially, and waiting for an error to occur (the error being that the email hasnt been created) that if the email "MESSAGE" already existed, that outlook would re-use it rather than creating a new instance, but it doesnt seem to work. OUTAPP and MESSAGE are both defined as public variables in the declarations section.
Someone please help!!
Thanks