Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2007

Tip: Looking for answers? Try searching our database.

Self Deleting Macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Luke Moraga - 19 Jun 2007 15:37 GMT
Hi,

I have a document which I am trying to prevent/make it difficult to copy. So
far, I have embedded an AutoOpen macro that detects if the file is not the
original, and if not, tells user that the document is a copy and then closes
the document immediately.

What I would like to do is have the macro also delete the file copy. I can't
figure out how to close the document though, AND continue running macro. Help
please?

Also, any help on how to handle situations where macros are disable would be
appreciated.
Signature

Best Regards,

Luke Moraga

Graham Mayor - 19 Jun 2007 15:57 GMT
There is no way on earth to prevent someone copying a document that you
allow them to see. Certainly a macro solution would take all of five seconds
to circumvent. An auto macro in a document would trigger a security warning
and the user would simply switch off macros.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hi,
>
[quoted text clipped - 9 lines]
> Also, any help on how to handle situations where macros are disable
> would be appreciated.
Luke Moraga - 19 Jun 2007 16:22 GMT
I understand that. Thankfully, this is more of a precaution to prevent
accidental copying. The people using this document are not very technicallu
adept, and most are trained to just allow macros to run.

Is there no way at all to have a macro delete the file its running from?
Signature

Best Regards,

Luke Moraga

> There is no way on earth to prevent someone copying a document that you
> allow them to see. Certainly a macro solution would take all of five seconds
[quoted text clipped - 14 lines]
> > Also, any help on how to handle situations where macros are disable
> > would be appreciated.
Bear - 19 Jun 2007 22:02 GMT
Luke:

I think the best you could hope for would be to delete the content of the
copy.

If you put your code in an AutoOpen or DocumentOpen subroutine in the
attached macro, you could probably delete the document. But that would depend
on the attached macro being present, which you can't guarantee. Or can you?

Bear

Signature

Windows XP, Word 2000

Luke Moraga - 20 Jun 2007 21:04 GMT
Thank you all!

I was able to get copies of the document to delete themselves on opening,
since its being opened in read-only.
Signature

Best Regards,

Luke Moraga

> Luke:
>
[quoted text clipped - 6 lines]
>
> Bear
Russ - 02 Jul 2007 23:22 GMT
But it's OK to open the original or a copy in WordPad or some other Word doc
viewer, which doesn't run macros?

> Thank you all!
>
[quoted text clipped - 11 lines]
>>> Also, any help on how to handle situations where macros are disable
>>> would be appreciated.
Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

Karl E. Peterson - 20 Jun 2007 01:58 GMT
> I understand that. Thankfully, this is more of a precaution to prevent
> accidental copying. The people using this document are not very technicallu
> adept, and most are trained to just allow macros to run.
>
> Is there no way at all to have a macro delete the file its running from?

If you *absolutely* insist <g>, have your macro:

 * Create a self-deleting batch file that does the dirty deed
 * Set Task Scheduler to run the batch file "a few/ten seconds from now"
 * Close the document

For step two, see http://groups.google.com/groups/search?q=task+scheduler+edanmo
Signature

.NET: It's About Trust!
http://vfred.mvps.org

Graham Mayor - 20 Jun 2007 07:04 GMT
I think you are in more danger from the training methods that cause users to
'just allow macros to run'. :( It is only a matter of time before one such
naive user brings in a  document from outside the organisation that contains
malicious code.

There is no way you can *guarantee* that users would allow the macros to
run. if you were able to guarantee it then you would be creating a virus
which will lead you into new realms of problems. Macros in distributed
documents are always fraught with problems. Why not supply them with a
template from which they can create the documents without the macros?

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I understand that. Thankfully, this is more of a precaution to prevent
> accidental copying. The people using this document are not very
[quoted text clipped - 30 lines]
>>> Also, any help on how to handle situations where macros are disable
>>> would be appreciated.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.