Automatically print file into printer

Hi,

I’m having problem how to activate printer dialog box to print text file automatically after creating it. How can I do that? Here’s my sample code:

Sub Click(Source As Button)

Dim session As New notessession

Dim db As notesdatabase

Dim doc As notesdocument

Dim view As NotesView

Set db = session.currentdatabase

Set view = db.GetView(“NamesView”)

Set doc = view.getfirstdocument

Dim filenum As Integer

filenum = Freefile()

filename = Cstr(“c:\NAMES”+“_”+Cstr(Replace(Cstr(Today), “/”, “-”))+“.TXT”)

Open filename For Output As filenum% Charset=“ascii”

While Not(doc Is Nothing)

FName = doc.FName(0)

MIname = doc.MIname(0)

LName = doc.LName(0)

Write #filenum%, FName, MIname, LName

Set doc = view.getnextdocument(doc)

Wend

Close filenum

printme = Shell("print.exe "+Cstr(filename), 1)

End Sub

This code simply creates the file… How can I print it without manually opening the file from the directory?

and

printme = Shell("print.exe "+Cstr(filename), 1) seems not functioning because there are no printouts coming from the printer…