Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 683
Default Excel Macro issue

I have a document that I have created exit macros for to set tab order and
another macro to force the enter key to function as the tab key but when I
use the mouse to click in a field, it tabs to the next field also. I need to
be able to click in any field and then be able to tab through the document
from there using the original tab order. This document must be locked down
in this manner or it won't work for us the way we need it to. Any assistance
would be appreciated.

Here's a copy of some of the macro's I've used, one for the tab order and
ther rest for the enter key to function as the tab key:

Sub Accent()
'
' Accent Macro
' Macro created 11/18/2009 by tgutz
'
Selection.GoTo What:=wdGoToBookmark, Name:="Direction"
End Sub
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.FormField s.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)).Disabl e
' Disables prompt to save template changes.
Templates(1).Save
End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Issue uploading macro enabled Excel to Sharepoint(xlsm using xla) test[_4_] Excel Discussion (Misc queries) 0 September 22nd 09 11:46 PM
MS Excel Macro issue msofficehelp Excel Discussion (Misc queries) 2 October 24th 08 01:12 AM
Doing MS Training in Excel, having Macro Issue Judi Excel Discussion (Misc queries) 15 July 17th 08 12:07 AM
Excel Macro- sort issue in Excel2003 Radhakrishna k.v.n.r[_2_] Excel Worksheet Functions 1 October 26th 07 10:02 AM
Excel 2007 Macro/Link Issue (apologies for cross-posting) MorgSz Links and Linking in Excel 2 July 25th 07 08:12 PM


All times are GMT +1. The time now is 01:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"