Command Button

J

Jack Gillespie

I have a 7 column table that I want to users to sort by clicking a command
button in the header row. It works fine one time. After clicking the
command button the names of the buttons are changed. If the button name is
"btnItems" it now becomes "btnItems1" or "btnItems11" depending on the number
of times it is clicked.

Does anyone know why this is happening and what I can do to stop it?
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SmFjayBHaWxsZXNwaWU=?=,
I have a 7 column table that I want to users to sort by clicking a command
button in the header row. It works fine one time. After clicking the
command button the names of the buttons are changed. If the button name is
"btnItems" it now becomes "btnItems1" or "btnItems11" depending on the number
of times it is clicked.

Does anyone know why this is happening and what I can do to stop it?
Can't even begin to guess without seeing the code it's running. Sounds, though,
like it's being removed, then recreated...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SmFjayBHaWxsZXNwaWU=?=,

OK... It looks like, due to the sort process, the button control is being
removed, then recreated. What about splitting the table header row from the
rest of the table? Split the table, then format the paragraph mark between the
two with a 1 pt font and minimal line spacing, so that it appears to be the
same table. Then change the macro accordingly (2nd table in the doc, no header
in the table).
The code is very simple and this snippet
shows how the buttons and subs are being renamed:


Private Sub btnDueDate_Click() 'Intial value
ActiveDocument.Tables(1).Select
ActiveDocument.Tables(1).Sort excludeheader, 5
End Sub

Private Sub btnDueDate1111_Click() ' renamed value after the command button
has been clicked 4x.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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