G
Greg Maxey
Hello,
I am working on a macro that I want to run from a menu command located on the "Table" menu. Like "Table Properties," I want this menu item dimmed if the selection is not in a table. I scratched around and found "WindowsChangeEvent" and cobbled together the following Class Module routine:
Option Explicit
Public WithEvents appWord As Word.Application
Private Sub appWord_WindowSelectionChange _
(ByVal oSel As Selection)
If oSel.Information(wdWithInTable) Then
CommandBars("Table").Controls("Table Data").Enabled = True
Else
CommandBars("Table").Controls("Table Data").Enabled = False
End If
End Sub
Seems to work like a charm. However, I am a little uneasy with the knowledge that every time I change the selection a macro is going to run. Hence the subject line. Is it sane to do what I have done. Is there a more appropriate method?
Thanks.
I am working on a macro that I want to run from a menu command located on the "Table" menu. Like "Table Properties," I want this menu item dimmed if the selection is not in a table. I scratched around and found "WindowsChangeEvent" and cobbled together the following Class Module routine:
Option Explicit
Public WithEvents appWord As Word.Application
Private Sub appWord_WindowSelectionChange _
(ByVal oSel As Selection)
If oSel.Information(wdWithInTable) Then
CommandBars("Table").Controls("Table Data").Enabled = True
Else
CommandBars("Table").Controls("Table Data").Enabled = False
End If
End Sub
Seems to work like a charm. However, I am a little uneasy with the knowledge that every time I change the selection a macro is going to run. Hence the subject line. Is it sane to do what I have done. Is there a more appropriate method?
Thanks.