Microsoft KB Archive/183451

From BetaArchive Wiki
Knowledge Base


Article ID: 183451

Article Last Modified on 11/23/2006



APPLIES TO

  • Microsoft Word 98 for Macintosh



This article was previously published under Q183451


SYMPTOMS

When you close a document protected for forms, you receive the following error message:

Can't perform requested operation

After receiving the error message, you cannot close or save your document.

CAUSE

This problem occurs when you do the following:

  • Create a document and protect it for forms (click Protect Document on the Tools menu).


-and-

  • While the protected document is open, create a Web page using the Web Page Wizard.

If you close the Web page you just created and attempt to save or close the protected document, the error will occur and you will not be able to save or close the protected document. Also, the Unprotect command is missing from the Tools menu.

This problem occurs because the underlying template add-in, Blank Web Page, for the Web Page Wizard is still active and all menu commands reflect the menus of the Blank Web Page template. When you choose one of the menu commands, such as Close on the File menu, a call is made to the HTML Library add-in. Because the Web Page has been closed, the call fails.

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

To resolve this problem, create and run the following macro.

The following macro unprotects the active document, removes the Blank Web Page template add-in, and then re-protects the active document.

   Sub RestoreMenus()
      Dim sDefPath As String

      ' Unprotect the document.
      If ActiveDocument.ProtectionType <> wdNoProtection Then
         ActiveDocument.Unprotect
      End If

      ' Remove the Blank Web Page add-in.
      ' (To restore the default menus.)
      sDefPath = Options.DefaultFilePath(Path:=wdUserTemplatesPath)
      AddIns(sDefPath & ":Web Pages:Blank Web Page").Installed = False

      ' Reprotect the document preserving form field contents.
      If ActiveDocument.ProtectionType = wdNoProtection Then
         ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
      End If
   End Sub
                

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

For additional information, please see the following article in the Microsoft Knowledge Base:

181058 OFF98: How to Run Sample Code from Knowledge Base Articles


For more information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base:

163435 VBA: Programming Resources for Visual Basic for Applications



Additional query words: vb vba vbe can t

Keywords: kbbug kbmacroexample kbpending KB183451