Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

More email

Status
Not open for further replies.

segmentationfault

Programmer
Jun 21, 2001
160
US
I have an Excel file with macros intended to function as an electronic log book. When the "template" file is opened, it is immediately given a new number and saved using that number in an archive directory.

When input is finished, a macro is executed to email a copy of the file to notify other users. I would like to preserve certain functionaliy in the original file and disable it in the emailed copies. What's the best way to determine if the current file has been copied?

Currently I am comparing filepaths to a constant defined in the code. The emailed copies are detected because their paths do not match. Is there a better way?
 
best way? Way to many possabilities for any chance of that.

I would place the 'original' File date time stamp somewhere in the Workbook. When the workbook is opened, have it retrieve the date/timestamp from the O.S., compare them (with some small window). If the two 'agree', it is the original - else it is a copy. Of course, whenever you modify the "original" you need to Update the internal timestamp.

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
My apologies, my question was worded poorly.

I've done the date/time stamp, however that doesn't address my situation very well. This is what I'm dealing with:

1. Template file was opened, renamed & saved in archive. Saving this file must update the logfile and send an email.

2. Emailed file was opened. This has no macro functions.

3. (Previously I differentiated between opening the template & renaming versus opening an archived file. This distinction is gone and the situation became a lot simpler.)

To achieve this, I am comparing the filepath of thisworkbook against the archive directory. If they match, we update the logfile and send an email, otherwise it's just a plain Excel workbook. This just seems like a sloppy hack to me, especially because the archive filepath is hardcoded, and I was wondering if there's a better practice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top