0 Replies Latest reply on Oct 17, 2008 2:44 PM by jeffrey.helle

    RoboHelp 5 & Word 2003

    jeffrey.helle
      Below is a macro, which disables the enter key while completing a form, that is contained within a 2003 Word Document. When the document is opened through WebHelp this error is produced: Runtime error 4605 : This command not available.

      However, if you go to the WebHelp directory and open the same document no error occurs.

      Another note - this same document works fine using Word 2007 via WebHelp.

      Any ideas?


      Sub EnterKeyMacro()
      ' Check whether the document is protected for forms
      ' and whether the protection is active.
      If ActiveDocument.ProtectionType = wdAllowOnlyFormFields And _
      Selection.Sections(1).ProtectedForForms = True Then
      ' Retrieve the bookmark of the current selection.
      ' This is equivalent to the name of the form field.
      myformfield = Selection.Bookmarks(1).Name
      ' Go to the next form field if the current form field
      ' is not the last one in the document.
      If ActiveDocument.FormFields(myformfield).Name <> _
      ActiveDocument.FormFields(ActiveDocument.FormFields.Count) _
      .Name Then
      ActiveDocument.FormFields(myformfield).Next.Select
      Else
      ' If the current form field is the last one,
      ' go to the first form field in the document.
      ActiveDocument.FormFields(1).Select
      End If
      Else
      ' If the document is not protected for forms,
      ' insert a tab stop character.
      Selection.TypeText Chr(13)
      End If
      End Sub
      Sub AutoNew()
      ' Do Not protect the template containing these macros.
      CustomizationContext = ActiveDocument.AttachedTemplate
      ' Bind the ENTER key to the EnterKeyMacro.
      KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
      KeyCategory:=wdKeyCategoryMacro, Command:="EnterKeyMacro"
      ' Reprotect the document with Forms protection.
      ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
      End Sub
      Sub AutoOpen()
      ' This macro will reassign the ENTER key when you open an existing
      ' Word form fields document.
      CustomizationContext = ActiveDocument.AttachedTemplate
      ' Bind the Enter key to the EnterKeyMacro.
      KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyReturn), _
      KeyCategory:=wdKeyCategoryMacro, Command:="EnterKeyMacro"
      End Sub
      Sub AutoClose()
      CustomizationContext = ActiveDocument.AttachedTemplate
      FindKey(KeyCode:=BuildKeyCode(wdKeyReturn)).Disable
      ' Disables prompt to save template changes.
      Templates(1).Save
      End Sub