»
 

Go Back   ResellerRatings Store Ratings > ResellerRatings Forums > Tech Support

Reply
 
LinkBack Thread Tools Display Modes
Old 01-12-2005, 06:20 PM   #1 (permalink)
Registered User
 
Join Date: Jan 2005
Posts: 2
KBolser is on a distinguished road
Disable button in only ONE instance of word.

I have a document that I use to log phone calls. I have now accidently clicked on the Print button instead of the Save button. So I wrote the following code to disable that button. (No more WASTE of 50 pages)

Public Sub Document_Open()
Application.ActiveDocument.CommandBars.FindControl (Type:=msoControlButton, ID:=CommandBars("Standard").Controls("Print").ID). Enabled = False
Application.ActiveDocument.CommandBars.FindControl (Type:=msoControlButton, ID:=CommandBars("Standard").Controls("Print").ID). TooltipText = "No Printing allowed in this document!"
End Sub

This does what I want, however, this does it in ALL instances of Word.

How do I get it to happen ONLY in that document?

Thank you.

KBolser is offline   Reply With Quote
Old 01-12-2005, 07:00 PM   #2 (permalink)
ResellerRatings Moderator
 
EvilRick's Avatar
 
Join Date: Jun 2004
Posts: 7,600
EvilRick has a reputation beyond reputeEvilRick has a reputation beyond reputeEvilRick has a reputation beyond reputeEvilRick has a reputation beyond reputeEvilRick has a reputation beyond reputeEvilRick has a reputation beyond reputeEvilRick has a reputation beyond reputeEvilRick has a reputation beyond reputeEvilRick has a reputation beyond reputeEvilRick has a reputation beyond reputeEvilRick has a reputation beyond repute
[code]

Private Sub App_DocumentBeforePrint _
(ByVal Doc As Document, _
Cancel As Boolean)
a = MsgBox("Have you checked the " _
& "printer for letterhead?", _
vbYesNo)
If a = vbNo Then Cancel = True
End Sub

[/colde]

This prompts before printing.
EvilRick is offline   Reply With Quote
Old 06-09-2005, 12:11 PM   #3 (permalink)
Registered User
 
Join Date: Jul 2004
Posts: 43
high63294 is on a distinguished road
!!!!!!!!

can you tell me how to write that code too,I mean where and how. that happen to me in a document and ooops there you see my printer wasting paper.

thanks in advance
high63294 is offline   Reply With Quote
Old 06-09-2005, 10:12 PM   #4 (permalink)
Registered User
 
Join Date: Jan 2005
Posts: 2
KBolser is on a distinguished road
I'll give that a go but...

I put in the line:

Application.ActiveDocument.CommandBars.FindControl (Type:=msoControlButton, ID:=CommandBars("Standard").Controls("Print").ID). Enabled = False

...and this grays out the print button. But it grays it out on EVERY instance. With your prompt or my gray-out is there any way to do it with only that one instance?

Or is that the difference between Public Sub and Private Sub?

Thanks
KBolser is offline   Reply With Quote
Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Most Active Discussions

Recent Discussions

All times are GMT -6. The time now is 08:28 PM.