printing opened document

yaniv

Centurion
Joined
Apr 15, 2002
Messages
167
Location
israel
i want to create a bottun that create a docuent, open it and print it in duplex mode.

.NET has a "printersettings" command that can print documents even in duplex, my problem is that i can't find the way to print the opened doc. it is very importend to open it because i want the program to make some changes in the doc context.

i include the code:
Private Sub printbottun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click


Dim oWord As Object
Dim oDoc As Object
Dim printer As String
Dim pd As New PrintDocument()

oWord = CreateObject("Word.application")

oWord.Visible = True

oDoc = oWord.Documents.Add
oDoc.Range.Select()


oWord.Selection.TypeText("This is on page 1" & vbCr)
oWord.Selection.InsertBreak(1)
oWord.Selection.TypeText("This is page 2")

pd.PrinterSettings.Duplex = Duplex.Simplex
pd.DocumentName = "documnet1"

odoc.Print()


end sub

the problem is that the odoc document is printing with out any connection to the printersetting i made!!!:(
 
can't undrstand the link, i understand how it open file or print closed one, but i don't understand how you can print opened file or hoe you print it in different print settings.

the problem is i can't print the saved file because i making changing in the original file that i don't want to keep.
 
Back
Top