|
-
Apr 27th, 2005, 08:37 AM
#1
Thread Starter
Member
Word Document Security
Try this one on for size,
My boss has asked me if there is a way that he can create a word document that can only be viewed x number of time and then automatically delete itself, or have the file "disappear" after x days.
Has anyone else attempted this or seen anything like this?
Thanks.
Kid Coke
-
Apr 27th, 2005, 09:15 AM
#2
Hyperactive Member
Re: Word Document Security
I think you could do that, but it wouldn't be foolproof, e.g. the user can disable macros or just hold the shift key while opening the doc. and I believe your startup VBA would be skipped.
Word VBA lets you save a variable with the document.
Checkout ActiveDocument.Variables(index)
So you could keep a counter or drop-dead date in there to check against. I've haven't tried it.
Deleting a doc while it's open may not work, but you could delete its contents and do an immediate save.
"The wise man doesn't know all the answers, but he knows where to find them."
VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15
-
Apr 27th, 2005, 10:35 AM
#3
Re: Word Document Security
About all you could do is if the x number of openings are reached, then close the doc without saving the changes.
VB Code:
ActiveDocument.Close False
I think the way MS does it with its beta versions is by making a registry entry and disables
the toolbars when the time is reached. No, you cant delete the document from WOM VBA.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 27th, 2005, 12:21 PM
#4
Thread Starter
Member
Re: Word Document Security
Thanks people!
I figured that using a macro to delete the document contents on x date followed by a save is the only way to pull this off.
Do you think there are otherways to make "self destructive" files (excel, acrobat, etc)
Let me know what you guys think.
-
Apr 27th, 2005, 12:37 PM
#5
Re: Word Document Security
Any way you try it, the file will need to be closed. You cant delete it from Word VBA.
Why go to all this trouble to delete it? If you prevent them from opening it after x number of times that should make them
want to delete it on their own.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 27th, 2005, 02:37 PM
#6
Thread Starter
Member
Re: Word Document Security
Rob .... I guess I didn't read your post carefully.
If the person were to copy the document with a new name and they open it will the limitations still exist?
Personally, I don't understand why my boss is going to all this trouble to protect this document but it seems important to him.
Thanks.
-
Apr 27th, 2005, 03:36 PM
#7
Addicted Member
Re: Word Document Security
you could create a DOS batch file.
e.g. word doc opens, VBA calls DOS batch file, which closes word, and deletes the file.
this will work even if they copy the file to another location as the DOS batch will always be in the same location with the same name and it is this that will do the deletion.
still doesnt help if the user disables VBA.
just a thought
if you fail to plan, you plan to fail
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|