Thread: [Solved] Hide Command Buttons
View Single Post
 
Old 01-04-2015, 05:14 AM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

OK, a link is one way to do it. You will find the additional functions I threw in useful in a variety of VBA projects.

As a generalisation, I would avoid using text boxes to format documents (you will note I removed one and replaced it with a bookmark for the insertion of text directly into the document). Text boxes just complicate things unnecessarily. This method of hiding buttons is a notable exception.

If you want boxes, use table cells or frames, as they are easier to process, being in the text 'layer' of the document.

Check VBA Editor > Tools > Options > Editor > Require Variable Declaration as this will help point out errors in your coding. It's a good idea to start on your VBA path by declaring all variables, and this will insist on it.

You can find the shapes index with a macro e.g.
Code:
Sub GetShapeIndex()
Dim i As Long
    For i = 1 To ActiveDocument.Shapes.Count
        ActiveDocument.Shapes(i).Select
        Application.ScreenRefresh
        MsgBox "Shapes(" & i & ") selected"
    Next i
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote