Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    'Tab' in code on a protected doc? (WinXP/Word2003)

    Could someone tell me, please, what is the VBA for the equivalent of pressing tab, when the instance of tab in question is being used to move between formfields in a protected document?

    Just using Selection.typetext = vbtab replaces the content of the formfield in question instead of moving on to the next one, and I can't record it because 'record macros' isn't available when the document is protected!!

    Many thanks
    Beryl M


  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: 'Tab' in code on a protected doc? (WinXP/Word2

    Perhaps there is a variation on Selection.MoveRight that will work in this case. Or myfield.range.select ?

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Re: 'Tab' in code on a protected doc? (WinXP/Word2

    Ah, now that sounds hopeful - I'll have to try that tomorrow morning!

    Thanks, Jan!
    Beryl M


  4. #4
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 'Tab' in code on a protected doc? (WinXP/Word2003)

    <P ID="edit" class=small>(Edited by JanB on 04-May-06 08:10. forgot Then on the ElseIf line...)</P>You can use Next/Previous to "tab" to the next/previous FormField in the tab-order:

    <font face="Georgia">ActiveDocument.FormFields("Name").N ext.Select
    ActiveDocument.FormFields("Name").Previous.Select</font face=georgia>

    If you don't know the name (or index-number) of the FormField, use this to retrieve that (probably found this or similar on the mvps site):

    <font face="Georgia">Public Function GetNameFF()
    On Error Resume Next
    GetNameFF = "ERROR"
    If Documents.Count < 1 Then Exit Function
    With Selection
    If .FormFields.Count = 1 Then 'Checkbox or Listbox
    GetNameFF = .FormFields(1).Name
    ElseIf .FormFields.Count = 0 And .Bookmarks.Count > 0 Then 'Textbox
    GetNameFF = .Bookmarks(.Bookmarks.Count).Name
    End If
    End With
    End Function</font face=georgia>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •