Woxsen University MBA Placements [Salary and Recruitment Analysis]
WATPI Prep
Workshops
CAT' 23 Analysis
RTI Response
Selection Criteria 2023
Rankings
Best 50
Placements
Score Vs. %ile

Excel tips and tricks - Project Management: How to send an email automatically through Excel VBA

Comments
 

Argha De

Hi, great article on excel automation. However, there are couple of things in the code which I would like to highlight in order to make it more generic. 1) The code assumes that there are only 3 rows of data (A2:A5). If any other row is automatically added, then the code would need to be changed again, which can be trouble some for people who are not conversant with programming. 2) The email sender sub routine is dealing with outlook only. If the user uses any other email app (mozilla thunderbird etc.), then the code might throw errors. Again changes has to be made programmatically. Resolutions: 1) Code: Dim sh as worksheet Dim n as integer set sh = ActiveWorkbook.ActiveSheet n=2 while sh.Range("A" & n) "" 'Prog logic n = n+1 wend 2) Use workbook.sendmail function: this is a generic method and can be used with any email app. However, options like CC, BCC or setting the body of the mail can not be done. For that outlook has to be used. But this can be useful for someone who is not using outlook. Syntax: ActiveWorkbook.Sendmail abc@gmail.com "Mail subject" if the requirement is to send the mail to multiple recipients at one go, then the mail ids can be stored in an array and the array can be used in sendmail. Hope this helps

15 Jun 2014, 06.15 PM

Argha De

A small correction: while sh.Range(“A” & n) ""

15 Jun 2014, 06.21 PM

Argha De

For some reason not-equality sign ( less than symbol followed by greater than symbol) is not getting printed in the comments. The while loop should be: while sh.Range(“A” & n) not-equality symbol “”

15 Jun 2014, 06.24 PM

Mini Mock Test

CUET-PG Mini Mock 2 (By TISS Mumbai HRM&LR)

Participants: 382

CUET-PG Mini Mock 3 (By TISS Mumbai HRM&LR)

Participants: 171
WATPI S04 (Quiz)
College Comparison Tool - Quiz Ad

CUET-PG Mini Mock 1 (By TISS Mumbai HRM&LR)

Participants: 757

MBA Admissions 2024 - WAT 1

Participants: 189

SNAP Quantitative Skills

Participants: 505

SNAP Quant - 1

Participants: 937

SNAP VARC Mini Mock - 1

Participants: 923

SNAP Quant Mini Mock - 2

Participants: 349

SNAP DILR Mini Mock - 4

Participants: 237

SNAP VARC Mini Mock - 2

Participants: 431

SNAP Quant Mini Mock - 4

Participants: 185

SNAP LR Mini Mock - 3

Participants: 241

SNAP Quant Mini Mock - 3

Participants: 202

SNAP VARC Mini Mock - 3

Participants: 293

SNAP - Quant Mini Mock 5

Participants: 51

XAT Decision Making 2020

Participants: 442

XAT Decision Making 2019

Participants: 348

XAT Decision Making 2018

Participants: 447

XAT Decision Making -10

Participants: 583

XAT Decision Making -11

Participants: 456

XAT Decision Making - 12

Participants: 417

XAT Decision Making - 13

Participants: 352

XAT Decision Making - 14

Participants: 354

XAT Decision Making - 15

Participants: 394

XAT Decision Making - 16

Participants: 466

XAT Decision Making - 17

Participants: 511

XAT Decision Making 2021

Participants: 514

LR Topic Test

Participants: 2690

DI Topic Test

Participants: 1221

ParaSummary Topic Test

Participants: 2038

Take Free Test Here

Comments
 

Argha De

Hi, great article on excel automation. However, there are couple of things in the code which I would like to highlight in order to make it more generic. 1) The code assumes that there are only 3 rows of data (A2:A5). If any other row is automatically added, then the code would need to be changed again, which can be trouble some for people who are not conversant with programming. 2) The email sender sub routine is dealing with outlook only. If the user uses any other email app (mozilla thunderbird etc.), then the code might throw errors. Again changes has to be made programmatically. Resolutions: 1) Code: Dim sh as worksheet Dim n as integer set sh = ActiveWorkbook.ActiveSheet n=2 while sh.Range("A" & n) "" 'Prog logic n = n+1 wend 2) Use workbook.sendmail function: this is a generic method and can be used with any email app. However, options like CC, BCC or setting the body of the mail can not be done. For that outlook has to be used. But this can be useful for someone who is not using outlook. Syntax: ActiveWorkbook.Sendmail abc@gmail.com "Mail subject" if the requirement is to send the mail to multiple recipients at one go, then the mail ids can be stored in an array and the array can be used in sendmail. Hope this helps

15 Jun 2014, 06.15 PM

Argha De

A small correction: while sh.Range(“A” & n) ""

15 Jun 2014, 06.21 PM

Argha De

For some reason not-equality sign ( less than symbol followed by greater than symbol) is not getting printed in the comments. The while loop should be: while sh.Range(“A” & n) not-equality symbol “”

15 Jun 2014, 06.24 PM