Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-28-2010, 08:39 AM
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-can't do anything


I spent considerable time working on a form and then protected it so that I could "beta" test it. In the process of fine tuning it, and going in and out of design mode while protecting and unprotecting the form, I managed to protect the form while in design mode. Now I cannot exit design mode or unprotect the form. HELP!
Reply With Quote
  #2  
Old 12-28-2010, 10:27 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: 20,465
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Hi DrDtMM,

Protected - whilst in Design Mode? Not with forms protection, I suspect. Did you perhaps set the 'Password to Modify' (see under File|Save As > Tools > General Options)?
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 12-28-2010, 11:00 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

When I finished modifying the form and was ready to test using it, I exited design mode, protected the file with forms protection (which is how one would want to distribute the form) and saved it. Unfortunately, when I opened the file again, it was protected, but in design mode. So I, the developer, couldn't even turn protection off at that point. Fortunately I had a back-up copy of the form. As it stands now, unless I find a better work-around, I'm going to have to distribute the form file unprotected with instructions to the recipient on how to exit from design mode. This is unfortunate since most Word users have never heard of design mode. My instructions include a rendering of the design mode ikon (attached hereto) to help the recipient find it because it may be almost anywhere on their screen, if it is there at all.

Dan Diamond
Attached Images
File Type: jpg Word Design-Mode Ikon.jpg (23.3 KB, 11 views)
Reply With Quote
  #4  
Old 12-28-2010, 11:59 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: 20,465
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Hi Dan,

Try the following macro - it should get the 'locked' document out of design mode:
Code:
Sub UnlockFile()
If ActiveDocument.FormsDesign = True Then
  ActiveDocument.ToggleFormsDesign
End If
End Sub
Note: If this is the only macro in the document, you'll want to delete the code module before saving the document, otherwise you'll get a macro-enable prompt next time you open it.

If that works, but you still have the document going into design mode when you re-open it, try using the following to force it out of design mode every time it's opened:
Code:
Private Sub AutoOpen()
' Runs when this document is opened.
If ActiveDocument.FormsDesign = True Then
  ActiveDocument.ToggleFormsDesign
End If
End Sub
Unfortunately, this also means you'll get the macro-enable prompt whenever you open the document.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]

Last edited by macropod; 12-29-2010 at 01:45 PM.
Reply With Quote
  #5  
Old 12-29-2010, 12:53 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 Protected form opens in design mode

Kevin,

I went directly to your second suggestion, and inserted the code ahead of the first design object definition code. This seemed reasonable since it was labeled (general). Unfortunately, the form continued to open in design mode. Then it occurred to me that maybe instead of testing for FormsDesign and toggling FormsDesign if it were True, why not just set it to false. So I replaced the If...End If with ActiveDocument.FormsDesign = False. I was guessing of course, and haven't done any programming since the '70's, but it seemed logical. Unfortunately, that didn't work either. Assuming that your code is structured correctly and the parameter is, in fact, named FormsDesign and it is Boolean, I don't know why your code (or my variation) shouldn't have worked unless I put it in the wrong place. I tried to put the code elsewhere, but couldn't figure out how. So I am still sitting with the same problem....and no one else has suggested another solution. I do appreciate your willingness to help me.

Dan
Reply With Quote
  #6  
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: 20,465
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
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
[MS MVP - Word]
Reply With Quote
  #7  
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, 3 views)
Reply With Quote
  #8  
Old 12-29-2010, 03:06 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

Previous message should have read near the end, "put your code in the right place". Sorry.
Reply With Quote
  #9  
Old 12-29-2010, 05:13 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: 20,465
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Hi Dan,

When I open your document (using Word 2000), with or without the macro in it, there's no evidence of design mode being active and I can protect/unprotect it at will.

I've re-saved the protected version without the macro. See if it works now on your system.

With the macro, you'd ordinarily put the code in a normal code module. Also, the line:
.FormsDesign = False
apparently needs to be changed to:
If .FormsDesign = True Then .ToggleFormsDesign
Attached Files
File Type: doc Digital Class Survey.doc (192.5 KB, 2 views)
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #10  
Old 12-29-2010, 07:59 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

I am sorry to report that the file you sent back to me opened in design mode. This makes me wonder whether my W2000 is up-to-date. I know that my XP is. This is very distressing.

I also do not understand what you mean by "a normal code module". I do not know how to do that or where such a module would be located. My experience using MS Word for anything but writing documents (that do not need the formatting control afforded by MS Publisher) began yesterday. I have no experience with Visual Basic, though my programming background, which took place primarily between 1963 and 1969, during which time I did extensive programming is many languages including Algol and Pl/I, permitted me to follow the code that you wrote.

I really appreciate your help here, but I am beginning to wonder whether I should have attempted to use Word in this manner without considerably more knowledge about it and experience with it. This Survey Form is the simplest of three forms associated with my high-school 50th reunion (of which I am co-chair); all of them have to be ready to distribute via email by January 23. They are also being distributed on paper. The idea of using digital forms is to minimize the effort that will subsequently be required to analyze the Survey and to publish the 50th Reunion Book, which will incorporate biographies of all class members who submit them and for which I am personally responsible. Obviously, having the information arrive in digital form would save me and my committee considerable effort. I also have the option of distributing a Word file with none of these special text boxes, check boxes, etc., and just extract what my classmates insert into such a file, which is what we did for our 40th reunion. I thought that using Word Design Mode would be a more elegant and powerful solution, but I am beginning to feel that it isn't in the cards.

Dan Diamond
Reply With Quote
  #11  
Old 12-29-2010, 09:28 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: 20,465
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Hi Dan,

You might try starting Word without loading any existing documents. If it starts in design mode, try switchin it off & re-starting Word. Beyond that, it's time to start trouble-shooting. For some tips on that front, see:
http://lounge.windowssecrets.com/ind...owtopic=197827
http://word.mvps.org/FAQs/AppErrors/...artingWord.htm and
http://support.microsoft.com/kb/921541

Re:
Quote:
I also do not understand what you mean by "a normal code module". I do not know how to do that or where such a module would be located.
That's what you get when you open the vba (Alt-F11) and use Insert|Module.

One of the things you've probably observed with your document is that, even without any vba code in it, you get a macro-enable prompt when you open the document. That's because you've used ActiveX fields to gather the data. If you'd used formfields, you wouldn't get the prompt. Plus, with formfields, the Enter key works as normal (you use the tab key to move between fields) and you can specify a maximum number of characters, numeric data only, and so on. Plus, if you put the formfield in a table cell of fixed dimensions, that constrains the amount of visible data that can be input into the formfield whilst at the same time maintaining a consistent appearance for the document's layout (eg page breaks stay put).
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #12  
Old 01-23-2011, 01:15 AM
hansj hansj is offline Form protected in design mode-can't do anything Windows Vista Form protected in design mode-can't do anything Office 2010 32bit
Novice
 
Join Date: Jan 2011
Posts: 1
hansj is on a distinguished road
Default Solution with normal.dotm?

I encountered the same problem with design mode in another context. Every time I opened a document (that contains an AutoOpen procedure), I was told that code could not be executed in design mode.

The following solution worked. Place this procedure in normal.dotm:

Private Sub AutoOpen()

Dim Index As Byte

With ActiveDocument.VBProject
For Index = 1 To .VBComponents.count
With .VBComponents(Index)
If .HasOpenDesigner Then .DesignerWindow.Close
End With
Next
End With

End Sub

"Private" to ensure that there will be no conflict with other "AutoOpen" procedures.

I found this code somewhere on the net. My only contribution is placing it universally functioning in Normal.dotm (and using "Byte" in stead of "Long").

The funny thing is that after having closed and opened Word one or two times I could remove this piece of code from Normal.dotm - and the problem was gone.

Best wishes
HansJ
Reply With Quote
  #13  
Old 01-23-2011, 12:37 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

Thank you. My timing was such that I had to go without text boxes and other niceties. Your suggestion may well be useful in the future.

Dan Diamond
Reply With Quote
Reply

Tags
design mode, protected form

Thread Tools
Display Modes


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 - Senior Forums

All times are GMT -7. The time now is 06:55 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