Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determine which commandbar called a function

Hello,

I have been using the following function to change the faceid on a
commandbar button once it has been clicked:

Function ChangeFace()
Dim OldCTRL

Set OldCTRL =
CommandBars("SHOW").Controls(CommandBars.ActionCon trol.Caption)

OldCTRL.FaceId = 1087

OldCTRL.Style = msoButtonIconAndCaptionBelow
End Function

The function is called when each button is clicked.

the line Set OldCTRL = CommandBars("SHOW").Controls
CommandBars.ActionControl.Caption) sets which button on the commandbar named
SHOW called the function.

I would like to be able to capture which commandbar and which button called
the function so I can use the same function from different commandbars.

Something like (pseudo code)
Set OldCTRL =
CommandBars(ActiveCommandBar).Controls(CommandBars .ActionControl.Caption)

Any help is greatly appreciated,
Kevin



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default Determine which commandbar called a function

Just use...
Set OldCtrl = Application.CommandBars.ActionControl
And...
OldCtrl.Parent will return the controls location, but there is no need for this in the situation you describe.
--
Jim Cone
Portland, Oregon USA



"Sgt Waddle"
wrote in message
Hello,
I have been using the following function to change the faceid on a
commandbar button once it has been clicked:

Function ChangeFace()
Dim OldCTRL
Set OldCTRL =
CommandBars("SHOW").Controls(CommandBars.ActionCon trol.Caption)
OldCTRL.FaceId = 1087
OldCTRL.Style = msoButtonIconAndCaptionBelow
End Function

The function is called when each button is clicked.
the line Set OldCTRL = CommandBars("SHOW").Controls
CommandBars.ActionControl.Caption) sets which button on the commandbar named
SHOW called the function.
I would like to be able to capture which commandbar and which button called
the function so I can use the same function from different commandbars.
Something like (pseudo code)
Set OldCTRL =
CommandBars(ActiveCommandBar).Controls(CommandBars .ActionControl.Caption)

Any help is greatly appreciated,
Kevin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default SOLVED Determine which commandbar called a function

A little Google and 'Bob's your uncle!'

I did not need to name the CommandBar

Function ChangeFace()
Application.CommandBars.ActionControl.Style = msoButtonIconAndCaptionBelow
Application.CommandBars.ActionControl.FaceId = 1087
End Function

Thanks!

"Sgt Waddle" wrote:

Hello,

I have been using the following function to change the faceid on a
commandbar button once it has been clicked:

Function ChangeFace()
Dim OldCTRL

Set OldCTRL =
CommandBars("SHOW").Controls(CommandBars.ActionCon trol.Caption)

OldCTRL.FaceId = 1087

OldCTRL.Style = msoButtonIconAndCaptionBelow
End Function

The function is called when each button is clicked.

the line Set OldCTRL = CommandBars("SHOW").Controls
CommandBars.ActionControl.Caption) sets which button on the commandbar named
SHOW called the function.

I would like to be able to capture which commandbar and which button called
the function so I can use the same function from different commandbars.

Something like (pseudo code)
Set OldCTRL =
CommandBars(ActiveCommandBar).Controls(CommandBars .ActionControl.Caption)

Any help is greatly appreciated,
Kevin



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determine which commandbar called a function

Jim,

I didn't see your reply until after I solved it.

Thanks for taking the time to reply.
Kevin

"Jim Cone" wrote:

Just use...
Set OldCtrl = Application.CommandBars.ActionControl
And...
OldCtrl.Parent will return the controls location, but there is no need for this in the situation you describe.
--
Jim Cone
Portland, Oregon USA



"Sgt Waddle"
wrote in message
Hello,
I have been using the following function to change the faceid on a
commandbar button once it has been clicked:

Function ChangeFace()
Dim OldCTRL
Set OldCTRL =
CommandBars("SHOW").Controls(CommandBars.ActionCon trol.Caption)
OldCTRL.FaceId = 1087
OldCTRL.Style = msoButtonIconAndCaptionBelow
End Function

The function is called when each button is clicked.
the line Set OldCTRL = CommandBars("SHOW").Controls
CommandBars.ActionControl.Caption) sets which button on the commandbar named
SHOW called the function.
I would like to be able to capture which commandbar and which button called
the function so I can use the same function from different commandbars.
Something like (pseudo code)
Set OldCTRL =
CommandBars(ActiveCommandBar).Controls(CommandBars .ActionControl.Caption)

Any help is greatly appreciated,
Kevin




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
What is this function called?? jPaulB Excel Discussion (Misc queries) 3 August 4th 06 08:33 PM
Custom Function being called when it shouldn't. Ron[_28_] Excel Programming 1 January 18th 05 06:13 PM
XLA function called twice Nigel[_9_] Excel Programming 0 November 16th 04 10:46 AM
Possible to know who has called a function ? Isabelle Robin Excel Programming 3 March 5th 04 12:33 AM
Save Event - Determine if called by code or user David Sedberry Excel Programming 0 October 2nd 03 04:56 PM


All times are GMT +1. The time now is 03:02 PM.

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

About Us

"It's about Microsoft Excel"