vba - Making a Lead Assignment email from excel spreadsheet -


i have extremely limited vba knowledge. have excel spreadsheet of lead contacts. want set drop-down list sends email specific person chose , returns contact info in body of email. don't know how email auto-populate , right now, email pops has "true" in body contact info rather returning text value in cell. how , add code fix this?

sub dropdown7_change()      dim answer string      answer = msgbox("are sure want assign lead?", _         vbyesno, "send email")     '    above code informs user automated email sent      'code uses users answer either carryout generated email process or not save changes.     if answer = vbno cancel = true     if cancel = true exit sub      if answer = vbyes           'connects outlook , retrieves information needed create , send email.         set outlookapp = createobject("outlook.application")         set olobjects = outlookapp.getnamespace("mapi")         set newmsg = outlookapp.createitem(olmailitem)          'contains email address of person receiving email.         newmsg.subject = "lead assigned you" 'sets automated subject line email         newmsg.body = "hello," & vbnewline & _             "you have been assigned lead. please follow contact" & vbnewline & _             activecell.offset(0, 3).range("k5").select             activecell.offset(0, 6).range("k5").select             activecell.offset(0, 7).range("k5").select          'above code has body of automated email         newmsg.display     end if  end sub ' end of function 

if trying values offset range("k5") , need use offset .value , range("k5").offset(0, 3).value , value 3 columns right of cell "k5".

the code below, add values 3 cells columns offset cell "k5" email body:

sub dropdown7_change()      dim answer string      answer = msgbox("are sure want assign lead?", _         vbyesno, "send email")     '    above code informs user automated email sent      'code uses users answer either carryout generated email process or not save changes.     if answer = vbno         exit sub     else         if answer = vbyes              'connects outlook , retrieves information needed create , send email.             set outlookapp = createobject("outlook.application")             set olobjects = outlookapp.getnamespace("mapi")             set newmsg = outlookapp.createitem(olmailitem)              'contains email address of person receiving email.             newmsg.subject = "lead assigned you" 'sets automated subject line email             newmsg.body = "hello," & vbnewline & _                 "you have been assigned lead. please follow contact" & vbnewline & _                 range("k5").offset(0, 3).value & vbnewline & _                 range("k5").offset(0, 6).value & vbnewline & _                 range("k5").offset(0, 7).value & vbnewline                                  'above code has body of automated email             newmsg.display         end if     end if  end sub  

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -