Hi =?Utf-8?B?bWo=?=,
How can I get the table toolbar to automatically appear when I am creating or
editing a table in Word 2003. I do not want the toolbar to be remain on all
the time.
There's nothing built into Word that will do this. There is a button on the
toolbar (right next to the one for inserting tables) that will turn it on,
though.
Other than that, you'd need a set of macros to manage this.
1. Display the VB Editor (Alt+F11)
2. Click on the "Normal" project, then Insert/Class
3. Copy or type the folliwng code into the class module
Public WithEvents x As Word.Application
Private Sub X_WindowSelectionChange(ByVal Sel As Selection)
If Sel.Information(wdWithInTable) Then
Application.CommandBars("Tables and Borders").Visible = True
Else
Application.CommandBars("Tables and Borders").Visible = False
End If
End Sub
4. Insert/Module
5. Into this module, copy or type the following code
Dim C As New Class1
Sub AutoExec()
ActivateEvents
End Sub
Sub ActivateEvents()
Set C.x = Word.Application
End Sub
Sub DeactivateEvents()
Set C = Nothing
End Sub
AutoExec will run when you start Word. ActivateEvents starts the code in the
class module. DeactivateEvents will turn the functionality off (but as things
stand, you'd need to run this manually; You could assign it to a toolbar button
if you wished). The code in the class considers where the cursor is (Sel =
Selection). If it's in a table, the toolbar shows; otherwise not. This is
triggered every time the location of the cursor in the document changes (except
when you're typing).
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail
