Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jk jk is offline
external usenet poster
 
Posts: 109
Default Restrict Command Button

I created a customized command buttom on the toolbar and assigned a macro to
reset date and time on one work book under personal XLS. The problem is now
every new workbook has this command button,,,,,,,how do i restrict or save it
so it remains only in this one work book?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Restrict Command Button

You would have to use the workbook_Open event to create it, and the
workbook_BeforeClose event to delete it. You would need the Activate and
deactivate events at the workbook level to unhide and hide it.

Also, you would add code to check if that particular workbook is the
activeworkbook when the code fires to insure no mistakes.

http://www.cpearson.com/excel/events.htm

for a discussion of events (Chip Pearson's site)

http://support.microsoft.com/default...b;en-us;830502
How to customize menus and menu bars in Excel

http://msdn.microsoft.com/library/en...ce04042002.asp

--
Regards,
Tom Ogilvy


"jk" wrote in message
...
I created a customized command buttom on the toolbar and assigned a macro
to
reset date and time on one work book under personal XLS. The problem is
now
every new workbook has this command button,,,,,,,how do i restrict or save
it
so it remains only in this one work book?



  #3   Report Post  
Posted to microsoft.public.excel.programming
jk jk is offline
external usenet poster
 
Posts: 109
Default Restrict Command Button

How would this affect the date and time stamp that the macro is used for? I
finally have a time and date stamp that works and does not reset itself every
time the work book opens.I have tried deleting the command buttom from the
other workbooks but then it deletes the command button on the orginal work
book as well.Is there another way to do this?

"Tom Ogilvy" wrote:

You would have to use the workbook_Open event to create it, and the
workbook_BeforeClose event to delete it. You would need the Activate and
deactivate events at the workbook level to unhide and hide it.

Also, you would add code to check if that particular workbook is the
activeworkbook when the code fires to insure no mistakes.

http://www.cpearson.com/excel/events.htm

for a discussion of events (Chip Pearson's site)

http://support.microsoft.com/default...b;en-us;830502
How to customize menus and menu bars in Excel

http://msdn.microsoft.com/library/en...ce04042002.asp

--
Regards,
Tom Ogilvy


"jk" wrote in message
...
I created a customized command buttom on the toolbar and assigned a macro
to
reset date and time on one work book under personal XLS. The problem is
now
every new workbook has this command button,,,,,,,how do i restrict or save
it
so it remains only in this one work book?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Restrict Command Button

You said commandbutton and then said it is on a toolbar.

Buttons on a toolbar are application level changes.

I assume you have attached a commandbar to the workbook. by deleting it
from other workbooks, I assume you have detached a copy of the commandbar
from the otherworkbooks.

If this is not the case, then you will need to explain exactly what you have
done.

If it is the case, then I have told you what you need to do.

--
Regards,
Tom Ogilvy

"jk" wrote in message
...
How would this affect the date and time stamp that the macro is used for?
I
finally have a time and date stamp that works and does not reset itself
every
time the work book opens.I have tried deleting the command buttom from the
other workbooks but then it deletes the command button on the orginal work
book as well.Is there another way to do this?

"Tom Ogilvy" wrote:

You would have to use the workbook_Open event to create it, and the
workbook_BeforeClose event to delete it. You would need the Activate
and
deactivate events at the workbook level to unhide and hide it.

Also, you would add code to check if that particular workbook is the
activeworkbook when the code fires to insure no mistakes.

http://www.cpearson.com/excel/events.htm

for a discussion of events (Chip Pearson's site)

http://support.microsoft.com/default...b;en-us;830502
How to customize menus and menu bars in Excel

http://msdn.microsoft.com/library/en...ce04042002.asp

--
Regards,
Tom Ogilvy


"jk" wrote in message
...
I created a customized command buttom on the toolbar and assigned a
macro
to
reset date and time on one work book under personal XLS. The problem is
now
every new workbook has this command button,,,,,,,how do i restrict or
save
it
so it remains only in this one work book?






  #5   Report Post  
Posted to microsoft.public.excel.programming
jk jk is offline
external usenet poster
 
Posts: 109
Default Restrict Command Button

Thank you for telling me about the command button being an application level
change if placed on the toolbar. Since i am new to this, I was not aware of
the impact so i moved it onto the sheet and it has resolved the
problems.Thanks for the support.

"Tom Ogilvy" wrote:

You said commandbutton and then said it is on a toolbar.

Buttons on a toolbar are application level changes.

I assume you have attached a commandbar to the workbook. by deleting it
from other workbooks, I assume you have detached a copy of the commandbar
from the otherworkbooks.

If this is not the case, then you will need to explain exactly what you have
done.

If it is the case, then I have told you what you need to do.

--
Regards,
Tom Ogilvy

"jk" wrote in message
...
How would this affect the date and time stamp that the macro is used for?
I
finally have a time and date stamp that works and does not reset itself
every
time the work book opens.I have tried deleting the command buttom from the
other workbooks but then it deletes the command button on the orginal work
book as well.Is there another way to do this?

"Tom Ogilvy" wrote:

You would have to use the workbook_Open event to create it, and the
workbook_BeforeClose event to delete it. You would need the Activate
and
deactivate events at the workbook level to unhide and hide it.

Also, you would add code to check if that particular workbook is the
activeworkbook when the code fires to insure no mistakes.

http://www.cpearson.com/excel/events.htm

for a discussion of events (Chip Pearson's site)

http://support.microsoft.com/default...b;en-us;830502
How to customize menus and menu bars in Excel

http://msdn.microsoft.com/library/en...ce04042002.asp

--
Regards,
Tom Ogilvy


"jk" wrote in message
...
I created a customized command buttom on the toolbar and assigned a
macro
to
reset date and time on one work book under personal XLS. The problem is
now
every new workbook has this command button,,,,,,,how do i restrict or
save
it
so it remains only in this one work book?






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
command button add another command Wanna Learn Excel Discussion (Misc queries) 5 December 7th 08 11:42 PM
VB's Command Button vs Form's Command Button Ronald Dodge Excel Programming 3 May 24th 06 02:23 PM
Command Button vs Form Button Bri[_3_] Excel Programming 2 February 3rd 06 08:18 AM
Command Button vs Control Button RGibson Excel Programming 1 October 14th 03 02:24 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM


All times are GMT +1. The time now is 09:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"