This example creates a toolbar button labeled "Copy To Port" that transmits the currently selected text to the host. The CopyToPortWithEnter method is used to define the action taken by this button.

Sub AddToolbarButtonToSendSelectedText()

With Session

.DefineToolbarButton _

ToolbarName:="Standard", _

Index:=16, _

Separator:=False, _

SmallPictureName:="", _

SmallPicIndex:=0, _

LargePictureName:="", _

LargePicIndex:=0, _

Label:="Copy To Port", _

Tip:="Transmit selected text to host", _

Help:="Transmit selected text to host", _

CommandType:=rcVBCommand, _


End With

End Sub