View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Running Code From Controls On Other Forms

You don't need to show form2 and in fact, that would stop your code from
executing. In form2 you would have to make all the event code Public rather
than private

Private Sub commandbutton1_Click()

Load Form2
Form2.commandbutton1_Click
Form2.commandbutton2_Click
Unload Form2
End Sub

--
Regards,
Tom Ogilvy


"bazman1uk " wrote in message
...
Tom,

Is not so much the problem of putting the vlues in the boxes. That woks
OK. It's running the code of the command buttons.

I need to be able to do this.

From say Form1

Click on Form1.commandbutton1

This then opens Form2
Runs Form2.commandbutton1
then run Fom2.commandbutton2
then hides Form2

I effectively want the code of Form1.commandbutton1 to be something
like this.

Private Sub commandbutton1_Click()

Form2.Show
Form2.commandbutton1_Click
Form2.commandbutton2_Click
Form2.Hide

End Sub

Baz


---
Message posted from http://www.ExcelForum.com/