Every time a user selects an item from
the File menu or an item on a toolbar
that is associated with a file command,
the OnFileCommand event is raised. The
event allows you to override the default
behavior for the control and supply your
own custom actions and dialog boxes to
do normal file operations.
You can also enable or disable items on
the File menu by using the
EnableFileCommand property. For example,
the following code disables the Open
command, and then traps print calls to
prevent a user from opening:
Private Sub Form_Load()
OfficeViewer.EnableFileCommand(dsoFileOpen)
= False
End SubPrivate Sub
Framer1_OnFileCommand(ByVal Item As _
OfficeViewer.FileCommandType, Cancel As
Boolean)
If Item = FileOpen Then
MsgBox "You asked to open, but I won't
allow it."
Cancel = True
End If
End Sub
|
Handle The Office File Commands |
| ||||||||||||||||||
