Results 1 to 7 of 7
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Bay Area, California, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Ctrl-Tab (2000 SR1)

    I want to assing the following code to Ctrl-Tab, unless my cursor is within a table, in which case I want to retain the default Ctrl-Tab behaviour (Tab within a table cell):

    ...
    'equivalent of Ctrl-F6
    ActiveWindow.Next.Activate
    ...

    Any advice how I can check for that?

    History and sidebar: way back when, the Windows default keyboard shortcut for switching apps (coolswitch) was (still is, of course) Alt-Tab. To switch between multiple documents in the same application I used Ctrl-Tab. All Windows programs I know supported this behaviour, except MS Word, where you have to use Ctrl-F6 to switch between open docs (Excel supports Ctrl-Tab!).

    I also finally found a solution to Words MDI interface (see "Fighting Desktop Pollution: Cleaning Up Word 2000's Single Document Interface" at http://www.msofficemag.net/features/1999/1...199911hk_f.asp) , a simple add-in template (Windows in Taskbar.dot) by Romke Soldaat, which forces all open Word docs into a single Taskbar button (icon). It also restores the behaviour of tiled Word documents, where you don't have a complete set of toolbars, menu bar and status bar for each tiled document, resulting in recovered desktop space and less clutter..

    So now more than ever I want to use what I consider a Windows standard keyboard shortcut: Ctrl-Tab to switch between open docs.

    Any help with detecting whether my cursor is within a table cell is much appreciated. Also, to avoid an error when the current doc is the only doc, I simply redirect any error to my Exit label and exit the sub without any action. A better way would be to check the document count, and only proceed it count > 1. Any ideas?

    If you came up with a solution, please let me.
    Thanks,

  2. #2
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Ctrl-Tab (2000 SR1)

    Hi Klaus,

    You can use .Information(wdWithInTable) to check whether the Range/Selection is in a table.
    But there are a few other difficulties. One is that you can't assign the shortcut Ctrl+Tab with the user interface; you would have to run the macro "AssignShortcut" below once.
    Another is that ActiveWindow.Next.Activate often fails with an error (at least in Word2000), even if there are several documents open. I tried to work around that, and hope it works now.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>Klaus

    <pre>Sub AssignShortcut()
    CustomizationContext = NormalTemplate
    KeyBindings.Add _
    KeyCode:=BuildKeyCode(wdKeyTab, wdKeyControl), _
    KeyCategory:=wdKeyCategoryMacro, Command:="CtrlTab"
    End Sub</pre>

    <pre>Sub CtrlTab()
    If Selection.Information(wdWithInTable) Then
    Selection.TypeText Chr(9)
    Else
    If ActiveWindow.Next Is Nothing Then
    If ActiveWindow.Previous Is Nothing Then
    Else
    ActiveWindow.Previous.Activate
    End If
    Else
    ActiveWindow.Next.Activate
    End If
    End If
    End Sub</pre>


  3. #3
    Lounger
    Join Date
    Jan 2001
    Location
    Bay Area, California, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Ctrl-Tab (2000 SR1)

    Hi Klaus <img src=/S/hello.gif border=0 alt=hello width=25 height=29>,

    your code worked like a charm. I put it in normal.dot, with toolbar icon, assigned shortcut and all.
    The universe is balanced once again <img src=/S/rofl.gif border=0 alt=rofl width=15 height=15>.

    Thanks,

    Klaus <img src=/S/groovin.gif border=0 alt=groovin width=21 height=21>

  4. #4
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Ctrl-Tab (2000 SR1)

    Hi Klaus:
    I haven't tried this, but it seems that if you wanted to have Ctrl+tab always switch between documents, you could just assign the combination using Klaus' first macro & modify the second one, & then use Alt+0009 to create a tab in a table. That's not what you asked for, but you've given a good argument for changing the behavior & I may try this myself. <img src=/S/lightbulb.gif border=0 alt=lightbulb width=15 height=15>

  5. #5
    Lounger
    Join Date
    Jan 2001
    Location
    Bay Area, California, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Ctrl-Tab (2000 SR1)

    Phil,

    if I understand you correctly, that's actually what Klaus' code does. The Chr(9) tabs a table cell entry when I press Ctrl-Tab (after I assigned the shortcut), and "tabs" to the next document if my cursor is outside a table. Beautiful [img]/forums/images/smilies/smile.gif[/img]

    I can't believe I didn't do this sooner. It always annoyed me that Word violated what I considered to be a MS/Windows standard.

    You might want to take a look at the template I describe above that restores Word's MDI, another pet peeve of mine.

    Klaus

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Ctrl-Tab (2000 SR1)

    Hi Klaus:
    I was probably unclear. Actually, what I did (& like it) is assigned Ctrl+tab to switch documents whether or not I'm in a table. i.e. I gave up the Ctrl+tab = a tab character in a table. I will just use Alt+0009 for a tab in a table.

    I downloaded the "Fighting Desktop Pollution" more than a year ago & still haven't tried it. I actually like Alt+tabbing between documents, but I do hate that there are two sets of menus & toolbars when you "arrange documents". Now that I can Ctrl+tab between documents (I haven't used other office apps enough to get used to that function), I may give it a try.

    Cheers,

  7. #7
    Lounger
    Join Date
    Jan 2001
    Location
    Bay Area, California, USA
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Ctrl-Tab (2000 SR1)

    Oh, I get it now <img src=/S/bingo.gif border=0 alt=bingo width=15 height=22>.

    Re.: "but I do hate that there are two sets of menus & toolbars when you 'arrange documents' " - that's exactly the annoying behaviour that Romke Soldaat's clever code fixes (among other things).

    Klaus

Posting Permissions

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