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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling printing/saving Word docs from Visual Basic 6

Status
Not open for further replies.

chindas

Programmer
May 18, 2006
14
ES
Hi guys,

I´m developing a Visual Basic 6 / SQL Server APP. I need to use word / excel automation. (OCX seems not to work fine, so I discarded that possibility)

I want to use word /excel documents and I need to manage Printing, Editing from my Visual Basic app under some conditions

I´ve read it's possible to write events produced by word documents Before Printing, Before Saving, .. But I don´t know if there is any other way to make my app manages printing and saving, i.e. disabling /hiding saving or printing buttons..

Other issue is: ¿How could I make retrieving/saving word docs without being aware of it´s path and name?


Any idea is welcome

Thanks everyone
 
From a Word Macro:

Code:
Application.PrintOut FileName:="", Range:=wdPrintCurrentPage, Item:= _
        wdPrintDocumentContent, Copies:=1, Pages:="", PageType:=wdPrintAllPages, _
        Collate:=True, Background:=True, PrintToFile:=False, PrintZoomColumn:=0, _
        PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

From Excel:

Code:
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

The Macro Recorders in both programs are good, though Excel's is better.

I hope this helps.

Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top