#1
|
|||
|
|||
Set Macro so it runs when other open the Word Document
Hi, I have a very simple macro which works fine for me. The issue is that I can't seem to set it so that it operates when other people access the file which is really what I need. I would be grateful if any of you wise people can advise. Image 1 shows where the macro is located(NewMacros). It's in Projects under the document template which I thought meant it would work, not normal.dotm. Image 2 is the code I've used but I'm happy with that. I think it's something in the way I've got it set up but I've not been able to find out the issue despite many YouTube Videos and reading forums. Thank you for your time, L |
#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 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
MS WORD search macro slows way down as it runs | 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 |
Creating a macro from a non-saved Word doc that duplicates the current open document and saves it | mike0215 | Word VBA | 3 | 11-17-2017 01:40 PM |
Macro to Open to a Website When No Document Is Open | 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 |