PASSPORT Knowledge Base
Macros

Date Published: March 29, 2010

Title

Export Host Screen To Word Document

Macro Type

.ZMC

Description

This macro will export the current PASSPORT screen to a new Word Document where each row of the host screen is placed into a new row within the document. The user may then save the file as needed.

Sample Code


' This macro exports the current screen to a new Word Document.
Sub ZMain
 
' Create the Word objects
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add
Set objRng = objDoc.Bookmarks("\endofdoc").Range
objWord.Visible = true
Call Word_log (objLine, objRng)
End Sub
' Subroutine to export the host screen data
Sub Word_log (objLine, objRng)
  For i = 1 to 24
    objLine = GetString (i, 1, 80)
    objRng.InsertAfter objLine
    objRng.InsertAfter vbCRLF
  Next
End Sub

More Information