How to write the code to print a page on Visual Basic!! Help please?!?!?!?

I have a page on visual basic which, when run alters. I want to use a message box to ask the user whether they would like a print of either the whole page or certain aspects of it! What code would i need and where would i need to enter it?

Best Answer

1)You can use the object Printer.
Printer.ScaleMode=vbInches
Printer.CurrentX=2 'two inches from left
Printer.CurrentY=3 ' three inches from top
Printer.Print "Some Data"
Printer.EndDoc 'Send to printer

2)You can use the method PrintForm of each object Form.
Form1.printForm ' Send the form

3)You can create a file text and send the file to printer
Open "TESTFILE" For Output As #1 ' Open file for output.
Print #1, "This is a test" ' Print text to file.
Close #1
shell "ype TESTFILE>>lpt1" 'with lpt1 or
shell "C:\WINDOWS\system32\notepad.exe /pt TESTFILE"

5)You can creat a html page and open
shell "C:\Program Files\Internet Explorer\iexplore.exe page.html"

4)You can use the control DataReport o Crystal Report

6)You can send the texto to documento MS Word o Excell
Sub CreateDoc()
Dim WordObj As Word.Application
Dim WordDoc As Word.Document
Dim WordRng As Word.Range
Dim WordPar As Word.Paragraph
Set WordObj = CreateObject("Word.Application")
With WordObj
.WindowState = wdWindowStateMaximize
.Documents.Add
Set WordDoc = WordObj.ActiveDocument

Set WordRng = WordDoc.Range
With WordRng
.Font.Bold = True
.Font.Italic = True
.Font.Size = 16
.InsertAfter "Running Word From Access Using Automation"
.InsertParagraphAfter
'Insert a blank paragraph between the two paragraphs
.InsertParagraphAfter
End With
Set WordPar = WordRng.Paragraphs(3)

With WordPar.Range
.Bold = True
.Italic = False
.Font.Size = 12
.InsertAfter "Report Created: "
.Collapse Direction:=wdCollapseEnd
.InsertDateTime DateTimeFormat:="MM-DD-YY HH:MM:SS"
End With
.ActiveDocument.SaveAs "c:\My Documents\autCreateDate.Doc"
.Quit
End With
End Sub

30 Related Question Answers Found Date
Microsoft word? 2022-01-19 06:09
Help with html form redirect function - how do you redirect to external site after form submitted? 2022-01-19 06:09
How do i create a Java Library Maintenance System. Any recommended website for me to refer? 2022-01-19 06:04
How do i change the background of my picture using Adobe photoshop? 2022-01-19 06:04
what is RSS( technology) , advantage and disadvantage, funtion or system of RSS? 2022-01-19 05:57
is java programmer is also called java developer?please explain if there is a difference? 2022-01-19 05:38
How do you create a lead capture page by yourself? 2022-01-19 05:33
Can anyone tell me, concisely, the differences between vb, vb6, vbscript, vbnet? 2022-01-19 05:13
What does the suffix .INI in BOOT.INI mean? 2022-01-19 05:12
Is there a free software to to send direct html e-mail? 2022-01-19 04:57
write a program to add two numbers without using arithmetic opereations ( +,-,*,/,%)? 2022-01-19 04:57
Trigger Delete in SQL? 2022-01-19 04:40
???.net it's urgent !? 2022-01-19 04:18
hi frnds, which book is the best for pl sql "brush up" learning with "interview" point of view? 2022-01-19 04:13
can you plz explain me with this? 2022-01-19 04:00
How in C programming,we can assign a float value to a char value? 2022-01-19 03:54
How do I change my windows title bar using dreamweaver? 2022-01-19 03:44
What is the function of 'post slug' when writing a post in WordPress? 2022-01-19 03:43
Question about visual c++? 2022-01-19 03:42
Visual Basic 6 ADO problem? 2022-01-19 03:37
Why do a lot of ERP implementaions fail?javascript:void(0);? 2022-01-19 03:25
hello , plz where i could find a free library"" psd files ""specially landscape images? 2022-01-19 03:24
Where do I get a good tutorial for SAP & ABAP programming online for free? 2022-01-19 03:13
How can I access samba shared folder in the shell(linux)? 2022-01-19 03:13
Any GOOD web page designers you can trust on line? 2022-01-19 03:03
How can I animate my picture? 2022-01-19 02:54
my C programs are compiling with no error in turbo c++ 3.0..bt i am not able to see the output???plz help..? 2022-01-19 02:46
phpbb upgrade within php-nuke? 2022-01-19 02:31
how do i get? 2022-01-19 02:23
who composed the theme music you hear when you open windows xp? 2022-01-19 02:21