Consulting

Results 1 to 4 of 4

Thread: How to call sub(which is personal.xls) in activeworksheet.

  1. #1

    Question How to call sub(which is personal.xls) in activeworksheet.

    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.
    Thanks
    Sankar

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Application.Run "Personal.xlsb!myMacro"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    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.
    Thanks
    Sankar

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Sorry Sankar, but the problem is eluding me. If you know the toolbar name, you should be able to enable/disable controls from anywhere.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •