View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default custom toolbar button questions

I interpreted you to run a macro in the new workbook containing the imported
form

But You want to run the imported form form a different workbook.

This is the situation that requires extraordinary measures. Extraordinary
measures means you have to have code in the users workbook that displays the
userform in the users workbook. If you want that, then it would be easier
to use the onaction property of the commandbar button to reassign the button
to that workbook when it is active using the workbook.activate or
worksheets.activate events.

Or
you need to modify the Master form to run from the master workbook ('N:\My
Documents\Excel\RECCU\FSA\Blank1.xls') but have the userform and its code
designed to work with data in the users workbook.

--
Regards,
Tom Ogilvy


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i guess what happens, is no matter which macro i assign to the custom
button, it always references that workbook and that macro from which it

was
installed. the button is part of "my excel" configuration, so no matter
which workbook i open, that button points to the workbook and macro

assigned
to it. i would have to go to each computer that i want to access the form
and create a custom button. but then when that user moved to another
computer, it would create a problem again,

what's the best way to activate the form in each user's workbook, i don't
want it to load unless they click a button and i didn't want to create a
command button on each sheet.

--


Gary


"Tom Ogilvy" wrote in message
...
Code can't run userforms in other workbooks without taking extraordinary
measures, so it should use the userform in that workbook.

tools=Customize,
This puts Excel in a design mode for commandbars. Leave the dialog
showing,
then go to your button and right click on it. Select Assign macro.
Change
the setting for what macro to run.


In code, you can do something like

Application.Commandbars("Custom 1").Controls(3).OnAction =
"MyWorkbooks.xls!MyMacro"

--
Regards,
Tom Ogilvy


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i created a user form in my master workbook. created a new macro button
to
run it. i then exported the user form and imported it into the client's
workbook. when i click the macro button, it opens my workbook and runs
the
form.

so, i have 2 questions:

1. how do i edit the custom button to assign which macro it runs? ended
up
deleting it and creating a new one.

2. how do i specify in the code to run show the userform from the

current
workbook?

i tired thisworkbook.userform1.show and activeworkbook.userform1.show.



--


Gary