Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-24-2012, 06:12 PM
yessmarie yessmarie is offline Running a Macro in a protected form Windows 7 64bit Running a Macro in a protected form Office 2007
Novice
Running a Macro in a protected form
 
Join Date: May 2012
Posts: 4
yessmarie is on a distinguished road
Exclamation 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
Reply With Quote
  #2  
Old 05-25-2012, 12:04 AM
macropod's Avatar
macropod macropod is offline Running a Macro in a protected form Windows 7 64bit Running a Macro in a protected form Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,762
macropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud ofmacropod has much to be proud of
Default

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
[MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Editable chart in a protected form vinod533 Word 0 02-02-2012 08:52 PM
Running a Macro in a protected form 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


All times are GMT -7. The time now is 02:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft