PDA

View Full Version : How to call sub(which is personal.xls) in activeworksheet.



sankartalam
08-17-2008, 04:02 AM
Folks,
could anyone give me the solution for my following requirement!
I have 5 modules in my vb code and each module has 2 or 3 sub programs in personal.xls and one private sub program (which is Worksheet_SelectionChange()) in the active work sheet. I have to call one of the sub program which there in any of the module when the selection changes.
For better understanding the senerio I am sending you the modules&sub programs hierarchy pictures.
Sheet2 is the active work book sheet.
I want to call one of the sub program in the toolbar module whenever the selection changes.

Bob Phillips
08-17-2008, 04:04 AM
Application.Run "Personal.xlsb!myMacro"

sankartalam
08-17-2008, 04:20 AM
Thanks alot for your fast reply XLD.
I have tool bar code in the toolbar module. In that toolbar code i have create menubar sub program. to this menubar i have added buttons. what I am doing with my selection change code is that I am enabling or disabling toolbar buttons. by calling createmenubar sub program.
by using
Application.CommandBars(ToolBarName).Controls(1).Enabled = False
as my toolbar module is in personal.xls, its throwing exception.
could you please help me to resolve my issue.

Bob Phillips
08-17-2008, 05:46 AM
Sorry Sankar, but the problem is eluding me. If you know the toolbar name, you should be able to enable/disable controls from anywhere.