Deleting buttons in Word through VBA code

S

sigein

Hello all ,

There is a neat feature in PowerPoint that when creating a new
presentation, labels appear saying for example: "Click to add title".
I want to do this in Word.

Im doing this in a template where I have added two buttons with
equavelent text as the one above. When I then click the button I want
the button to dissapere and let me just type in some title or
whatever.
Private Sub CommandButton1_Click()
Selection.Delete
End Sub

ofcourse there is a problem:
After I have deleted the first button and it does get deleted! I click
the other button, but nothing happens. Even if the other button does
nothing more than msgbox "me something".

NOTE! This only happens in a template, which should be relatively easy
to make(there are only image formats allowed for attatched files here
at the forum). Both buttons gets deleted if not in a template!!

Has anyone an idea of a solution?

brg, Siggi
 
J

Jonathan West

Hi sigein,

The normal way of addressing this is to use a MACROBUTTION field. Several of
the Microsoft standard templates which ship with Word have placeholders
implemented this way. Take a look at one of them and see how it is done.
 
S

sigein

Thank you very much Jonathan West. That did it for me

For information purposes:
1) Macrobutton does'nt have frame like a regular button
2) when the buttons caption is too long that it has to be broken into 2
lines it forces you to use two macrobuttons instead of one regular.

In my case these drawbacks dont matter.
brg, Siggi
 

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