Saturday, May 14, 2011

Basic's to write a report text file.

Run this with a PCB file active.
Sub WriteFile

Dim FileName
Dim ReportDocument
Dim fso
Set Board = PCBServer.GetCurrentPCBBoard
If Board is Nothing Then Exit Sub
'Run With a PCB file open

FileName =  Left(Board.FileName, InstrRev(Board.FileName, "\") ) & "temp.Txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set ReportFile = fso.CreateTextFile(FileName, True)

Call ReportFile.WriteLine (Now)
Call ReportFile.WriteLine ("Report File Example")

Set ReportDocument = Client.OpenDocument("Text", FileName)
If Not (ReportDocument Is Nothing) Then
End If

End Sub