Send Email via MailEnvelope (VBA, Excel) -
i want create macro copies specific range outlook (with images). doesn't work want to...
sub send_range_or_whole_worksheet_with_mailenvelope() 'working in excel 2002-2016 dim aworksheet worksheet dim sendrng range dim rng range on error goto stopmacro application .screenupdating = false .enableevents = false end 'fill in worksheet/range want mail 'note: if use 1 cell send whole worksheet set sendrng = worksheets("email").range("b2:w41") 'remember activesheet set aworksheet = activesheet sendrng ' select worksheet range want send .parent.select 'remember activecell on worksheet set rng = activecell 'select range want mail .select ' create mail , send activeworkbook.envelopevisible = true .parent.mailenvelope ' set optional introduction field thats adds ' header text email body. .introduction = "this test mail 2." .item .to = thisworkbook.sheets("email").range("z1").value .cc = thisworkbook.sheets("email").range("z1").value .bcc = "" .subject = thisworkbook.sheets("email").range("d1").value .display end end 'select original activecell rng.select end 'activate sheet active before run macro aworksheet.select stopmacro: application .screenupdating = true .enableevents = true end activeworkbook.envelopevisible = false end sub
can please tell me why mailenvelope showing 1 second , nothing happens afterwards? seems doesn't work me.
i replaced .send .display still nothing changes. alternativly tried use rngtohtml code code not copy images (i have dynamic linked picture in sheet "email").
your issue use
.display
but don't wait send , close envelope without sending: activeworkbook.envelopevisible = false
- just comment , dialog stay there send it.
if need use .send, or .display doesn't work @ all:
- running outlook in admin mode solves it
- changing ms outlook setting programatic access* "warn me if.." solved kind of me (displaying annoying dialog when using .send)
put msgbox err.description @ end debug error
msgbox err.description end sub
still trying figure out actual solution.
the mail send macro worked me stopped after while. not sure why. tried add registry keys (https://social.technet.microsoft.com/forums/ie/en-us/e2c89fec-beb3-4224-a6cb-112704406907/cannot-change-programmatic-access-security?forum=outlook). didn't work.
*what funny if disable ms outlook warning programatic access (https://www.slipstick.com/developer/change-programmatic-access-options/) - start ms o in admin , go setting - stops displaying warnig stops request , functionality. usual microsoft behaviour these days....
Comments
Post a Comment