Delete command button

P

PJ Usher

word 2000

My document has a command button that triggers transfering text from the
document to an excel spreadsheet. When the code is finished I would like to
delete the command button from the word document. How would I code this?
Thank you

Penny
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < PJ Usher > écrivait :
In this message, < PJ Usher > wrote:

|| word 2000
||
|| My document has a command button that triggers transfering text from the
|| document to an excel spreadsheet. When the code is finished I would like
to
|| delete the command button from the word document. How would I code this?
|| Thank you
||

IMO, the easiest is to put your command button inside a
borderless/zero-margin text box. Give a name to that text box, then delete
the text box, which will delete the command button inside it as well:

To name the text box, select it and use something like this:

Selection.ShapeRange(1).Name = "MyShape"

Then add this at the end of the command button code:

ActiveDocument.Shapes("MyShape").Delete


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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