Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLS CLS is offline
external usenet poster
 
Posts: 5
Default Assign Macro to Command Button doesn't work

Hi All,

I am trying to assign a custom macro to a custom command button I have
inserted into my menu bar. When I click on assign macro, there is no
listing of my custom macros I have created in VBA (custom .xla file). So I
type the macro name in. (Main.myMacro)

When I click on the button it says "book1.xls'Main.myMacro" does not exist.

of course not it is in myAddin.xla.

So I change it to myAddin.xla'Main.myMacro and it says it cannot open this
file because it is already open.

I have an old button that works with just Main.MyotherMacro. But if I type
Main.MyMacro it automatically changes it to "book1.xls'Main.myMacro" once I
close it.

I cannot remember how I got the other to work.

Please Help
Chad


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Assign Macro to Command Button doesn't work

Set the IsAddin property of your addin to False, assign the macro
to the command button, and the set the IsAddin property to True.
To set the property, go to the VBA editor, open the Immediate
Window (CTRL+G) and enter

ThisWorkbook.IsAddin = False ' then True to restore


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com








"CLS" remove NOT wrote in message
...
Hi All,

I am trying to assign a custom macro to a custom command button
I have inserted into my menu bar. When I click on assign
macro, there is no listing of my custom macros I have created
in VBA (custom .xla file). So I type the macro name in.
(Main.myMacro)

When I click on the button it says "book1.xls'Main.myMacro"
does not exist.

of course not it is in myAddin.xla.

So I change it to myAddin.xla'Main.myMacro and it says it
cannot open this file because it is already open.

I have an old button that works with just Main.MyotherMacro.
But if I type Main.MyMacro it automatically changes it to
"book1.xls'Main.myMacro" once I close it.

I cannot remember how I got the other to work.

Please Help
Chad



  #3   Report Post  
Posted to microsoft.public.excel.programming
CLS CLS is offline
external usenet poster
 
Posts: 5
Default Assign Macro to Command Button doesn't work

Worked Great
Thanks

"Chip Pearson" wrote in message
...
Set the IsAddin property of your addin to False, assign the macro to the
command button, and the set the IsAddin property to True. To set the
property, go to the VBA editor, open the Immediate Window (CTRL+G) and
enter

ThisWorkbook.IsAddin = False ' then True to restore


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com








"CLS" remove NOT wrote in message
...
Hi All,

I am trying to assign a custom macro to a custom command button I have
inserted into my menu bar. When I click on assign macro, there is no
listing of my custom macros I have created in VBA (custom .xla file). So
I type the macro name in. (Main.myMacro)

When I click on the button it says "book1.xls'Main.myMacro" does not
exist.

of course not it is in myAddin.xla.

So I change it to myAddin.xla'Main.myMacro and it says it cannot open
this file because it is already open.

I have an old button that works with just Main.MyotherMacro. But if I
type Main.MyMacro it automatically changes it to "book1.xls'Main.myMacro"
once I close it.

I cannot remember how I got the other to work.

Please Help
Chad





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign a macro to a command button SheriTingle Excel Discussion (Misc queries) 4 September 25th 06 06:38 PM
Assign a macro to Command Button Object dallin Excel Discussion (Misc queries) 2 July 13th 05 03:50 AM
How do I assign a macro I have created to a Command Button in Exc. Andrew7675 Excel Discussion (Misc queries) 1 March 3rd 05 08:08 PM
command button and assign macro Dave Peterson[_3_] Excel Programming 2 May 27th 04 03:01 AM
Assign Macro to Command Button Shunt Excel Programming 1 August 7th 03 02:07 PM


All times are GMT +1. The time now is 08:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"