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 / April 2007

Tip: Looking for answers? Try searching our database.

How can I run a macro on a protected Word document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mayavi - 08 Apr 2007 03:00 GMT
Hi Experts,

I am writing a TCL application using tcom which opens up a number of word
documents, unlinks some fields in them and then zips them up.

These documents are protected before they reach me, so when I try to
call the Run Macro method from TCL, i get the error that says "Macro
cannot run on protected document"

I am new to Word and VB and tcom. Any ideas on how to unprotect the document
first using tcl? Or is there  a way to use a password to unprotect the
document
before running the macro?

Any help appreciated

Newbie :)
old man - 08 Apr 2007 19:16 GMT
Hi,

This will unprotect a document that was protected without a password:

If ActiveDocument.ProtectionType <> wdNoProtection Then
  ActiveDocument.Unprotect
End If

If you it is password protected and you know it (lets say the password is
Lock25 then:

If ActiveDocument.ProtectionType <> wdNoProtection Then
  ActiveDocument.Unprotect Password:="Lock25"
End If

If you do not know the password there is no way through VBA to unlock it.
There are quite a few programs on the internet that will unlock Office files.

old man

> Hi Experts,
>
[quoted text clipped - 13 lines]
>
> Newbie :)
 
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.