#1
|
|||
|
|||
Running a Macro in a protected form
Hello!
I'm having trouble running a macro in a protected form. The macro I'm trying to run is one that will make a number sequence each time I print the form. I created this form and want to protect it so that it can be used as a Filling Form only. The problem is that when I click the macro shorcut to print the form it says that it can't because the document is protected. I'm pretty new at this so macro's and vba's are kinda hard for me to understand and use. Anybody know how to solve this?? Much thanks in advance!!!! Yess |
#2
|
||||
|
||||
Hi yessmarie,
You'll need to either have an editable formfield the macro can output the numbers to or unprotect the form so that they can be added. The unprotection can be done in code, as can re-protecting the form afterwards but, if the form is password protected, you'll need to supply the password via an inputbox or by hard-coding. The simplest approach would be to update a 'counter' formfield via a FilePrint macro. For example: Code:
Sub FilePrint() With ActiveDocument If .Bookmarks.Exists("Counter") Then With .FormFields("Counter") .Result = .Result + 1 End With End If End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Editable chart in a protected form | vinod533 | Word | 0 | 02-02-2012 08:52 PM |
Form protected in design mode-can't do anything | DrDtMM | Word VBA | 12 | 01-23-2011 12:37 PM |
Adding table lines to protected form | razberri | Word Tables | 2 | 10-27-2010 05:58 PM |
Font size changes in a protected form..? | jackbkmp | Word VBA | 0 | 03-03-2010 10:14 AM |
protected form with underline fillable spaces | rohitsahib | Word | 0 | 02-02-2006 10:22 AM |