PrintFile doesn't seem to work.

Brandon Cernicky brandon_cernicky at yahoo.com
Thu Mar 24 19:41:19 UTC 2005


If you have MS Word on your system, the following can
be used to print a document from E-Prime.  Something
similar using SendKeys could be done for Notepad.

'Show the mouse
Mouse.ShowCursor True

'Get the file to print
Dim strFilename As String
strFilename = OpenFilename$("Print Text File","Text
Files:*.txt")	

If strFilename <> "" Then

	Dim objWord As Object
	Set objWord = CreateObject("Word.Application")
	If Not objWord Is Nothing Then		

		Dim objDocument As Object
		Set objDocument =
objWord.Documents.Open(strFilename)
		If Not objDocument Is Nothing Then

			'Print
			objDocument.PrintOut

			'Give some time to print
			Sleep 2000
		Else
			MsgBox "Unable to open document"
		End If

		Set objDocument = Nothing


	Else
		MsgBox "Microsoft Word not found!"
	End if

	'Close no save and quit
	objWord.Documents.Close False
	objWord.Quit

End If

Set objWord = Nothing


>>> Hello all,
>>>
>>> A paradigm that I'm working on generates a report
>>> at the end that
>>> needs to be automatically printed. The PrintFile
>>> function in E-Basic
>>> does not seem to work as advertised. My paradigm
>>> compiles without
>>> errors, creates the .txt file without difficulty
>>> then chokes on
>>> PrintFile with all appropriate path parameters >>>
seeming to be fine. It
>>> gives me a 'function not supported' error when it
>>> gets to PrintFile.
>>> What gives? Has anyone succeeded in using this >>>
effectively?
>>>
>>> Thanks!
>>>
>>> -- IV
>>>


		
__________________________________
Do you Yahoo!?
Make Yahoo! your home page
http://www.yahoo.com/r/hs



More information about the Eprime mailing list