![]() |
#2
|
||||
|
||||
![]()
In order to run when the document is opened, the macro needs to be renamed AutoOpen and the document should be saved as macro enabled. However you cannot force the user to run the macro.
Code:
Sub AutoOpen() Const strPassword As String = "password" With ActiveDocument If Not .ProtectionType = wdNoProtection Then .Unprotect Password:=strPassword End If .Revisions.AcceptAll .Protect Password:=strPassword, _ NoReset:=False, _ Type:=wdAllowOnlyReading, _ UseIRM:=False, _ EnforceStyleLock:=False End With End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
Tags |
macro assign word |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Chopper | Word VBA | 8 | 12-21-2020 03:49 PM |
[Word VBA macro] How to open the website [languagetool.org] and check my Word document? | citroen | Word VBA | 0 | 10-25-2020 05:07 AM |
![]() |
mike0215 | Word VBA | 3 | 11-17-2017 01:40 PM |
![]() |
lostinwebspace | Word VBA | 1 | 02-13-2016 10:28 AM |
VB code from one document runs on other open documents | beav_35 | Word VBA | 0 | 11-10-2010 02:52 PM |