Send email based upon a particular user opening the file

gruple

New Member
Joined
Dec 5, 2005
Messages
8
Is there a way to send an email message to myself when a particular user has accessed a particular excel file? I have no idea how to even write code to send an email. Any help would be greatly appreciated. Thanks.
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Oaktree

MrExcel MVP
Joined
Jun 20, 2002
Messages
7,988
Welcome to the board.

The gist of what you're trying to do is, in the ThisWorkbook module, put:

Private Sub Workbook_open
if application.username = "gruple" then
' insert code to send e-mail here
end if
end sub

There are several examples for how to send mail via VBA on the board, with one of the sites referenced being:

http://www.j-walk.com/ss/excel/tips/tip86.htm

HTH
 

Watch MrExcel Video

Forum statistics

Threads
1,118,530
Messages
5,572,675
Members
412,481
Latest member
nhantam
Top