Reply
 
Thread Tools Display Modes
  #1   Report Post  
Jack Gillespie
 
Posts: n/a
Default Command Button

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?
  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?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 :-)

  #3   Report Post  
Jack Gillespie
 
Posts: n/a
Default

Cindy-Thanks for your response. 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.

End Sub


"Cindy M -WordMVP-" wrote:

Hi ?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 :-)


  #4   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?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 :-)

  #5   Report Post  
Jack Gillespie
 
Posts: n/a
Default

Cindy: Worked like a charm. Thanks for the insight.

"Jack Gillespie" wrote:

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?

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:39 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"