Reflection Desktop VBA Guide
Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Attachmate.Reflection.Objects.Emulation.OpenSystems Library / Printing Object / PrintToFile Property
Example
In This Topic
    PrintToFile Property (Printing)
    In This Topic

    Gets or sets whether printing is directed to the printer or a file.

    Syntax
    expression.PrintToFile As String
    where expression is a variable that represents a Printing Object

    Property Value

    The default is "".

    If this property is set to an empty string (""), printer output is directed to the printer.

    If this property is set to anything other than an empty string, its value determines the name of the disk file to which Reflection printer output is sent. This string can contain drive and path information. If the specified file already exists, Reflection appends printed data to the end of the file.

    Example
    This example logs commands and data entered and received and saves it in a text file when logging is stopped. To run this sample, copy the code to the ThisTerminal code window.
    Private Sub Terminal_Connected(ByVal sender As Variant, ByVal ConnectionID As Long, ByVal connnectionType As Attachmate_Reflection_Objects_Emulation_OpenSystems.ConnectionTypeOption, ByVal connectionSettings As Variant)
     
        'Start capturing text to a file:
        ThisScreen.ScreenPrinting.PrinterLogging = True
        ThisScreen.ScreenPrinting.PrintToFile = Environ$("USERPROFILE") & "\Documents" & "\test.txt"
        ThisTerminal.StartLogging
        
    End Sub
     
    Private Sub Terminal_Disconnected(ByVal sender As Variant, ByVal ConnectionID As Long, ByVal connnectionType As Attachmate_Reflection_Objects_Emulation_OpenSystems.ConnectionTypeOption, ByVal connectionSettings As Variant)
        
        'Stop capturing text to a file:
        ThisScreen.ScreenPrinting.PrinterLogging = False
        ThisTerminal.StopLogging
        
    End Sub
    See Also