vba - submit button and email - excel -


i have button , macro set allows sheet save folder , close sheet. there way can add macro email out message outlook saying along lines of "machine checklist submitted" test123@outlook.com example. below code have works treat.

sub saveworkbook() application.displayalerts = false dim sheet1 worksheet dim dname$, vname$, sname$     dname = range("b8")     vname = activeworkbook.fullname     sname = activeworkbook.activesheet.name     each sheet1 in activeworkbook.sheets     if not sheet1.name = sname     sheet1.delete     end if     next sheet1      activeworkbook.saveas "\\filestore\it$\forms , templates\completed checklists\" & dname & "_" & environ("username") & "_" & format(now, "ddmmyy")     activeworkbook.close application.displayalerts = true end sub 

thanks in advance sam

add below code

dim olapp object, olmail object  set olapp = createobject("outlook.application") set olmail = olapp.createitem(0)   olmail     .to = "test123@outlook.com"     .cc = ""     .bcc = ""     .subject = "machine checklist submitted"     .body = "machine checklist submitted"     .send end set olapp = nothing set olmail = nothing 

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -