IS there a way of generating reports from VB6 ( not through Data Reports & Crystal Reports ) which directly sends to a local printer and printing should be done fast, No matter what ever may be the font.

Recommended Answers

All 7 Replies

hey did u get answer for ur query as i am also in need of the answer for the same query. plz reply asap.

So... Suzz. Let's not post to threads that are two years old.

I can think of 2 function that could able to help you.
#1 Printing by IE
#2 Print Any kind of File

' #1 Print By IE

Dim oIE
Dim FileName
FileName = "c:\myfile.txt" ' or .html or .xml depending on where you stored the data you want to print
oIE = CreateObject("InternetExplorer.Application")
oIE.Visible = True ' You can change this to False
oIE.Navigate2 (FileName)
While oIE.ReadyState <> 4
Wend
oIE.ExecWB 6, 0  ' Print
'oIE.ExecWB 7, 0 ' Print Preview

#2 PrintFile Function

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    (ByVal hwnd As Long, _
     ByVal lpOperation As String, _
     ByVal lpFile As String, _
     ByVal lpParameters As String, _
     ByVal lpDirectory As String, _
     ByVal nShowCmd As Long) As Long
 FileName = "c:\myfile.txt" ' Any kind of file (xls doc xml html )
 nRetVal = ShellExecute(0, "Print", FileName, "", "", 0)

I did not notice that this post is 2 years old.

Should I delete my answer?

your syntax was written in .net. hahahah....
do u have any vb code to share?


please support this thread even it 2 year old posted. ^_^

your syntax was written in .net. hahahah....

It is vb6 but I did not know what is [ code=What? ] [ /code ] to write in vb6 syntax :)

do u have any vb code to share?

Actually I don't have any vb code to share.

The above 2 examples are my code in Visual foxpro, and I convert them to vb6 when I saw this message :)

please support this thread even it 2 year old posted. ^_^

Did you try the above example and they did not work?

What do you need to know more ?

IS there a way of generating reports from VB6 ( not through Data Reports & Crystal Reports ) which directly sends to a local printer and printing should be done fast, No matter what ever may be the font.

How about a way to render directly to the browser a PDF from either a stream, or XML/XSL File. If you know of a way lmk.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.