Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-29-2010, 02:10 PM
macropod's Avatar
macropod macropod is offline Form protected in design mode-can't do anything Windows 7 32bit Form protected in design mode-can't do anything Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,523
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Dan,

Whos's Kevin?



The issue with the AutoOpen macro is that it won't run as a Private sub. Delete 'Private' and it should run. However, if the document is protected, as you say it is, you'll get a run time error. The document needs to be unprotected before you can change the design mode.

Try as I might, though, I can't get Word to protect a document and leave it in design mode. So developing & testing code to get a protected document out of design mode is somewhat problematic ...

Give the following a go. It'll work with a protected document and explcity turns off design mode.
Code:
Sub AutoOpen()
' Runs when this document is opened.
Dim Pwd As String ' String variable to hold passwords for protected documents
Dim pState As Boolean ' Document protection state flag
With ActiveDocument
  ' Insert your document's password between the double quotes on the next line
  Pwd = ""
  ' Initialise the protection state
  pState = False
  ' If the document is protected, unprotect it
  If .ProtectionType <> wdNoProtection Then
    ' Update the protection state
    pState = True
    ' Unprotect the document
    .Unprotect Pwd
  End If
  ' Swith off Design Mode
  .FormsDesign = False
  ' If the document was protected, reprotect it, preserving any formfield contents
  If pState = True Then .Protect wdAllowOnlyFormFields, Noreset:=True, Password:=Pwd
End With
End Sub
The code can be run manually or by opening the document.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 12-29-2010, 03:04 PM
DrDtMM DrDtMM is offline Form protected in design mode-can't do anything Windows XP Form protected in design mode-can't do anything Office 2000
Novice
Form protected in design mode-can't do anything
 
Join Date: Dec 2010
Posts: 7
DrDtMM is on a distinguished road
Default Form protected in design mode

The email messages that are sent to me indicating that there has been a posting to this thread come from Kevin@msofficeforums.com, so I jumped to the wrong conclusion.

I inserted the latest code you provided in place of the previous code. An error message came up telling me that macros were disabled and that I should enable them. I tried to use Word's help function to learn how to do that, but I was unsuccessful. So I have attached the latest version of the Word 2000 file that represents the form I have been trying to create so that you can see if I have done something wrong. I am not at all sure that I have but your code in the write place, but I'm not sure where else to put it.

Thanks, again, for your help.

Dan
Attached Files
File Type: doc Digital Class Survey Form (beta) rev 3.doc (196.0 KB, 15 views)
Reply With Quote
Reply

Tags
design mode, protected form



Similar Threads
Thread Thread Starter Forum Replies Last Post
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
Editing Password protected form fields in Word 2007 tamilan Word 2 02-16-2010 09:45 AM
Form design question aalytics Word 0 12-04-2009 07:32 PM
protected form with underline fillable spaces rohitsahib Word 0 02-02-2006 10:22 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:46 PM.


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