Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET and Word-Bookmarks

Status
Not open for further replies.

CosoGuy

Programmer
Jul 8, 2004
4
CA
Hi,

I do a merge between my word (.dot) template and value entered on my vb.net form.

Below is my code.
The problem I have is when a document is printed, I see Word appearing in the taskbar. For maybe a quarter second, but still I don't want to. With all the properties I set, isn't supposed to be all processes background and not visible.

Thanks for helping.

Dim objWord As Word.Application

objWord = CreateObject("Word.Application")

With objWord
.ActivePrinter = "TOSHIBA e-STUDIO16/20/25 PCL 6"
.Visible = False
.WindowState = Word.WdWindowState.wdWindowStateMinimize
.Documents.Open("C:\Projets\Taxi_Diamond\Comite_de_discipline\FORMULAIRE_DE_PLAINTE_FR10.dot")

.ActiveDocument.Bookmarks.Item("siPLAINTE").Select() 'word doc bookmark
.Selection.Text = clsClass.NoPlainte
.ActiveDocument.Bookmarks.Item("siMEMBRE").Select() 'word doc bookmark
.Selection.Text = clsClass.NoMembre
.ActiveDocument.Bookmarks.Item("siPOCKET").Select() 'word doc bookmark
.Selection.Text = clsClass.NoPocket

.PrintOut(Copies:=1, Collate:=True, Background:=True, PrintToFile:=False)

'Wait for document to print
Do While .BackgroundPrintingStatus > 0
Application.DoEvents()
Loop

.Documents.Close(Word.WdSaveOptions.wdDoNotSaveChanges)
.Quit()
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top