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?
How to write the code to print a page on Visual Basic!! Help please?!?!?!?
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%26gt;%26gt;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
wholesale flowers
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment