Hide command button in word doc
I have a .doc with a command button (cmdStart) that opens a form. After filling out the form, I click a button to close the form and fill in the .doc.
I want to hide the original cmdStart on the .doc and also when the form is closed Ive tried document.shapes (1) .visible = false and cmdStart.visible = false but none works.
Any ideas?
thanks (ps, I can't just open the form from autotune, I need cmdStart to be visible to begin with)
a source to share
You have several options for solving this problem. However, you won't be able to hide your command button, but you can remove it.
Removing a command button can be done with the following code:
Private Sub CommandButton1_Click()
CommandButton1.Select
Selection.Delete
End Sub
(Note that you can usually hide text in Word by setting a hidden font, such as calling Selection.Font.Hidden
. However, this does not affect controls.)
If you removed the button and you need it later, you will have to recreate it. In this case, it would be nice to mark the position of the bookmarked button.
Another option is to use the MACRO button field. Such a field can be inserted from the Insert Field dialog box and can be used to run a macro.
a source to share