Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problems running macro from custom menu item

Hi folks - I'm trying to assign a small macro to run from
a new menu item in Excel 97. I've create an xla add-in
with the macro in it and added the new menu item via
Customize Toolbar-Commands-Macros-Custom Menu Item.

When I go to the 'Assign Macro' option for the new menu
item, my macro is not listed. I can type it in and it
works fine when I've manually loaded the xla. I then copy
my xla to a network location and set that Default File
Location to this path. When I open Excel, the new menu
option is there ok, but I get the and error saying 'The
macro 'test' cannot be found'.

It's got me stumped unfortunately. I can't find anything
in Excel Help or the MS website, so any help would be much
appreciated.

Thanks.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problems running macro from custom menu item

You need to reassign the macro (from it new location) to the button.

in the immediate window you can query the onaction property of the control
to see where it is point. It will be pointing to the wrong location if you
get this message.

--
Regards,
Tom Ogilvy

"RichardB" wrote in message
...
Hi folks - I'm trying to assign a small macro to run from
a new menu item in Excel 97. I've create an xla add-in
with the macro in it and added the new menu item via
Customize Toolbar-Commands-Macros-Custom Menu Item.

When I go to the 'Assign Macro' option for the new menu
item, my macro is not listed. I can type it in and it
works fine when I've manually loaded the xla. I then copy
my xla to a network location and set that Default File
Location to this path. When I open Excel, the new menu
option is there ok, but I get the and error saying 'The
macro 'test' cannot be found'.

It's got me stumped unfortunately. I can't find anything
in Excel Help or the MS website, so any help would be much
appreciated.

Thanks.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problems running macro from custom menu item

Thanks Tom - not sure I follow you. How do I reassign the
button correctly, as I've already done so via the
customize menu option several times without any luck -
does it need to be done elsewhere?

-----Original Message-----
You need to reassign the macro (from it new location) to

the button.

in the immediate window you can query the onaction

property of the control
to see where it is point. It will be pointing to the

wrong location if you
get this message.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problems running macro from custom menu item

You said you assigned it, then moved the file with the macro (as i
understood you). Excel isn't congnizant of that change and apparently
doesn't search for it (default file location would have no effect in this
situation) or you wouldn't get the message. Assign the macro as you did in
the past, but do it after you move the file.

--
Regards,
Tom Ogilvy


"RichardB" wrote in message
...
Thanks Tom - not sure I follow you. How do I reassign the
button correctly, as I've already done so via the
customize menu option several times without any luck -
does it need to be done elsewhere?

-----Original Message-----
You need to reassign the macro (from it new location) to

the button.

in the immediate window you can query the onaction

property of the control
to see where it is point. It will be pointing to the

wrong location if you
get this message.




  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Problems running macro from custom menu item

Ah, got you now - sorry. I've tried that just now but
unfortunately still get the same error. I've completely
removed the macro assignment and then reassigned it
without any luck.

-----Original Message-----
You said you assigned it, then moved the file with the

macro (as i
understood you). Excel isn't congnizant of that change

and apparently
doesn't search for it (default file location would have

no effect in this
situation) or you wouldn't get the message. Assign the

macro as you did in
the past, but do it after you move the file.

--
Regards,
Tom Ogilvy


"RichardB" wrote in

message
...
Thanks Tom - not sure I follow you. How do I reassign

the
button correctly, as I've already done so via the
customize menu option several times without any luck -
does it need to be done elsewhere?

-----Original Message-----
You need to reassign the macro (from it new location)

to
the button.

in the immediate window you can query the onaction

property of the control
to see where it is point. It will be pointing to the

wrong location if you
get this message.




.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problems running macro from custom menu item

I tied a button to a macro with (using a macro):

commandbars("Custom 2").Controls(1).OnAction = "'C:\Documents and
Settings\togilvy\Application Data\Microsoft\AddIns\File2.xla'!button_click"

I then queried it in the immediate window:

? commandbars("Custom 2").Controls(1).OnAction
'C:\Documents and Settings\togilvy\Application
Data\Microsoft\AddIns\File2.xla'!button_click

When I pressed the button, the Addin was opened and the macro executed.

Perhaps you can do the same (better yet, select the addin in tools=Addins
so it is automatically loaded)

--
Regards,
Tom Ogilvy



wrote in message
...
Ah, got you now - sorry. I've tried that just now but
unfortunately still get the same error. I've completely
removed the macro assignment and then reassigned it
without any luck.

-----Original Message-----
You said you assigned it, then moved the file with the

macro (as i
understood you). Excel isn't congnizant of that change

and apparently
doesn't search for it (default file location would have

no effect in this
situation) or you wouldn't get the message. Assign the

macro as you did in
the past, but do it after you move the file.

--
Regards,
Tom Ogilvy


"RichardB" wrote in

message
...
Thanks Tom - not sure I follow you. How do I reassign

the
button correctly, as I've already done so via the
customize menu option several times without any luck -
does it need to be done elsewhere?

-----Original Message-----
You need to reassign the macro (from it new location)

to
the button.

in the immediate window you can query the onaction
property of the control
to see where it is point. It will be pointing to the
wrong location if you
get this message.




.



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
Excel 2000 Custom Menu Item Larry Bird Excel Discussion (Misc queries) 0 November 8th 05 08:25 PM
VBA-Make Custom Menu Item Fire d_rodman Excel Programming 3 July 27th 04 03:29 PM
Setting OnAction of custom menu item? Ed[_18_] Excel Programming 12 May 10th 04 02:55 PM
Custom Menu Item specific to a workbook Tommy T Excel Programming 1 January 23rd 04 07:34 PM
Problems deleting custom menu = double entries BenD Excel Programming 2 November 3rd 03 11:14 AM


All times are GMT +1. The time now is 02:11 PM.

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"