Managing and printing activeX buttons

L

Leanne

Hi,

I'm writing a summary document in which I have included a
table of contents and created hyperlinks to the bookmarked
ToC entries and would like to add a button the the end of
each page of the document to return the reader to the ToC.

I've added a button and hyperlink and all is fine but I
don't want the button to be visible in the printed version
of the document as it isn't needed in that format. I'm
hopeless at VB but assume that if it is possible to hide
the button for printing,I'll need to write some kind of VB
code.

Can someone please help?

Thanks in advance. L
 
J

Jay Freedman

Hi Leanne

First, create a new style (in the Format > Style dialog, click New)
and name it ReturnButton. It can have the same formatting as an
existing style (such as Hyperlink style), or you can make it look like
whatever you want for your buttons.Then apply that style to each
button/hyperlink.

You need two macros, one to intercept the File > Print menu item and
one to intercept the Print button on the toolbar (see
http://word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm for an
explanation of intercepting Word's commands with properly named
macros). Each macro changes the color of the ReturnButton style to
white, carries out the original action of the command (show the Print
dialog or just print), and then undoes the color change.

Instructions for putting the macros in place are at
http://www.gmayor.com/installing_macro.htm. Here are the macros:

Public Sub FilePrint()
ActiveDocument.Styles("ReturnButton").Font.ColorIndex = wdWhite
Dialogs(wdDialogFilePrint).Show
ActiveDocument.Undo
End Sub

Public Sub FilePrintDefault()
With ActiveDocument
.Styles("ReturnButton").Font.ColorIndex = wdWhite
.PrintOut Background:=False
.Undo
End With
End Sub
 
L

Leanne

Actually, it wasn't as hard as it looked, but it didn't
work, the button still printed :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top