Disable print command in Microsoft Word

This agent connects to Microsoft Word and disables the Print command in Word.

This Content Component encountered an error

This agent connects to Microsoft Word and disables the Print command in Word. It is done through Lotusscript. To enable the Print command, you need to set the control enable property to true.


'This script disables the print command in Menubar of Microsoft word



Sub Initialize
	Dim xlFilename As String
	
	Dim session As New NotesSession
	xlFilename="C:\Book2.doc"     'Any word document to be opened
	Dim db As NotesDatabase       
	Dim doc As NotesDocument
	Dim w As New NotesUIWorkspace
	Dim WordDocs As Variant        
	Dim WordDoc As Variant
	
	Dim oMainMenuBar As Variant   'Handle of the Word Menubar
	Dim submenu As Variant			 'Handle of the Print command in the Menubar
	Dim submenu1 As Variant
	Dim control1 As Variant
	Dim control2 As Variant
	
	Dim object As Variant
	Dim WordObj As Variant
	
	Dim prints As Variant
	
	Dim workspace As New NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	Set uidoc = workspace.CurrentDocument
	
	Set db = session.CurrentDatabase
	
	
	Set WordObj = CreateObject("Word.Application")           'Create a word object
	WordObj.visible = True                                    'To make the word document visible
	Set WordDocs = WordObj.Documents
	
	Print "Opening.." & xlFilename &"...."
	WordObj.Documents.Open xlFilename        'Opens the required filename
	Set WordDoc = WordObj.ActiveDocument       
	
	Set oMainMenuBar = WordObj.CommandBars.Item("Menu Bar")
	Set submenu=oMainMenuBar.Controls("&File")    'Initializes with the menubar control
'	Set submenu1=oMainMenuBar.Controls("&Edit")
	Set control1=submenu.Controls("⪻int...")        'Initializes with the Print control
'	Set control2=submenu.Controls("&Close")
	control1.Enabled=False                'Set to false disables the command on the Menubar
'	control2.Enabled=True
End Sub
This was first published in October 2001

Dig deeper on Lotus Notes Domino Administration Tools

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close