View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Arne Hegefors Arne Hegefors is offline
external usenet poster
 
Posts: 244
Default Refering to another module

I have a small problem with a macro. I have two different moduls in my code.
In module1 i have the code for some buttons and so and in module2 i have the
code for what happens if i press the buttons. However my code has trouble
finding the different modules and I need help on how to write this properly.
Code in module1:

Sub Create_Menu()
Dim MyBar As CommandBar
Dim MyPopup As CommandBarPopup
Dim button1 As CommandBarButton
......
Set button1 = .Controls.Add(Type:=msoControlButton)
With button1
.Caption = "Button!"
..BeginGroup = True
.OnAction = "button1_Click"

and in modul2:

Sub button1_Click()
Dim objChart As ChartObject


Now I need help with how to refer to the sub. My code is quite messy if i
have to have it in the same module so it would be prefect it that was
possible. Thanks very much in advance!