Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macros fail if file saved in another location


Hi Guys

Hope someone can help.

I have created a new application which incorporates a custom menu ba
with a range of options that are driven by macros specified in th
"Assign Macro" section of the option definition.

Works great until you move the file to another location and then try t
load it up. Excel gives an error that there is already a copy of thi
file running and it cant load a second copy, so the macros ar
obviously looking to load up the original file to be able to access th
macros as originally defined.

Anyone had this problem before and if so do you have a fix?

Any help would be appreciated.

Thank

--
Paul
-----------------------------------------------------------------------
PaulM's Profile: http://www.excelforum.com/member.php...fo&userid=1625
View this thread: http://www.excelforum.com/showthread.php?threadid=27659

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 535
Default Macros fail if file saved in another location

Hi PaulM,

I have created a new application which incorporates a custom menu bar
with a range of options that are driven by macros specified in the
"Assign Macro" section of the option definition.

Works great until you move the file to another location and then try to
load it up. Excel gives an error that there is already a copy of this
file running and it cant load a second copy, so the macros are
obviously looking to load up the original file to be able to access the
macros as originally defined.

Anyone had this problem before and if so do you have a fix?


Excel keeps toolbar and menubar customizations in a file with the
extension .xlb. The exact filename depends on Excel version and install,
but usually is: Excel9.xlb or Excel.xlb or Username8.xlb.
Often this file can be found in your WINDOWS directory.

You can attach a toolbar to a workbook. When this workbook is loaded, XL
checks if the toolbar is on the system. If not, it copies the toolbar
from the workbook to the system.

After creating *or changing* the toolbar, you should attach the toolbar
to your workbook:

- activate the workbook to which you want to attach the toolbar
- Rightclick the toolbar, select 'customize'
- Click 'Attach' (Toolbars Tab)
- If the workbook already contains a toolbar by that name, delete it
first by clicking on it on the righthand side and choosing Delete.
- Select your toolbar (on the left) and press 'copy'
- Save the workbook (optionally: save_as an add-in).

Also, you should include code that deletes the toolbar when your workbook
or add-in is closed, so that when you deliver a new version of your
workbook the new toolbar will be used i.s.o the old one. You can do that
in the Thisworkbook module, using the Workbook_BeforeClose event:

Private Sub Workbook_BeforeClose(Cancel as Boolean)
On Error Resume Next 'In case Toolbar is absent
Application.CommandBars("YourBarsName").Delete
End Sub

Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.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
fail to link a pdf file in excel 2003 with Adobe Acrobat 7.0 Prof eva cheng Excel Discussion (Misc queries) 0 December 2nd 09 07:40 AM
Location of Saved Message Being Compossed via Excel Send Worksheet dl270a Excel Discussion (Misc queries) 1 December 23rd 08 05:27 PM
Change location of auto saved back up copy of shared workbook? Roxanne M Excel Discussion (Misc queries) 4 May 24th 06 01:50 AM
Toolbar Buttons (macros) fail after filename change Andy Excel Programming 1 July 18th 04 12:57 AM
Fail if macros are not enabled? JonF Excel Programming 1 October 23rd 03 05:10 PM


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