Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
J J is offline
external usenet poster
 
Posts: 1
Default Excel - VBA Macro Not Found

I have a macro assigned to a toolbar button. Its asigned
with full reference (i.e. Workbookname!MacroName). When
user saves the workbook with a different name, it cann't
find the macro. What can I do so that its reference
is "Thisworkbook" or any other solutions...Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Excel - VBA Macro Not Found

I use something like this:

myCtrl.OnAction = ThisWorkbook.Name & "!MacroName"

If that doesn't work for you, you may want to copy and paste from your code. I
bet you don't really use: Workbookname!MacroName.



J wrote:

I have a macro assigned to a toolbar button. Its asigned
with full reference (i.e. Workbookname!MacroName). When
user saves the workbook with a different name, it cann't
find the macro. What can I do so that its reference
is "Thisworkbook" or any other solutions...Thanks


--

Dave Peterson

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel - VBA Macro Not Found

Hi, i had a similar question yesterday and Ian Ogilvy kindly donate
this information.

Hope it helps!

Simon

Here's the code!

applicaton.CommandBars("Custom1").Controls("ABCD") .OnAction = "Macro1"

assuming macro1 is in the workbook where the above is run.

so you would set up a line for each control on you custom commandbar.

do it in the workbook_open event. It is often useful to have you code
actually build the commandbar.

Here is an article about creating commandbars with code:
http://msdn.microsoft.com/library/techart/ofcmdbar.htm


other references:

http://support.microsoft.com/defaul...amp;Product=xlw
How to customize menus and menu bars in Excel


http://support.microsoft.com/?id=159619
XL97: Sample Macros for Customizing Menus and Submenus

http://support.microsoft.com/?id=213550
XL2000: Sample Macros for Customizing Menus and Submenus


http://support.microsoft.com/defaul...kb;en-us;166755
File Title: Customizing Menu Bars, Menus, and Menu Items i
Microsoft(R)
Excel 97
File Name: WE1183.EXE
File Size: 58041 bytes
File Date: 06/20/97
Keywords: kbfile kbappnote
Description: This Application Note can help you learn techniques fo
writing
Visual Basic(R) for Applications code to customize menus in Microsof
Excel
97. This Application Note contains code examples that you can use wit
the
following elements: menu bars, menus, menu items, submenus, an
shortcut
menus

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

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
macro-file could not be found puiuluipui Excel Discussion (Misc queries) 2 September 21st 09 07:31 PM
Macro cannot be found, but it is there? bwilk77 Excel Discussion (Misc queries) 2 April 13th 07 05:56 PM
Macro cannot be found Barney Excel Discussion (Misc queries) 2 April 4th 06 01:21 PM
macro not found Brian Murphy[_2_] Excel Programming 9 April 23rd 04 04:54 AM
Found a macro, but don't know how to use it lizator Excel Programming 2 September 12th 03 03:46 PM


All times are GMT +1. The time now is 11:57 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"