Question

Excel 97 Macros refer to original file name

Asked by: rhomulos

Hello,

I need the background theory on how to deploy custom Macro's and Toolbar's to a group of users.  Assume users to be on independent systems and they will be changing file names and locations.

I'm interested in how personal.xls works (Excel uses it but I can't find where its stored or how to play with it)

I'm thinking of using an XLA and having people double click it first or put in their XLstart directories but would like something which is transparent to the users.

Would Macro's and Toolbars in templates work well??

Thank you

Matthew

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
1999-09-15 at 19:26:42ID10206789
Tags

excel

,

macro

,

where

Topic

Microsoft Office Suite

Participating Experts
2
Points
100
Comments
17

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. personal.xls
    When i open excell, it always starts with personal.xls. When i want to open another document, it says personal.xls is already in use and makes it a read-only file. Where can i change this?
  2. Excel 97 -  Personal.xls missing...
    Greetings, I am programmatically adding Commandbar buttons to the standard toolbar in Excel 97. In order to save these Commandbar buttons, I need to save the global template - Personal.xls. In Excel 2000 I am able to save the Personal.xls file but I cannot locate the Pers...
  3. Updataing XLstart with a personal.xls module
    I have created a macro and saved in personal.xls of my PC. I now want to get this module into another users personal.xls so they can use it on demand by either a command button on the toolbar or shortcut keys. 1. I open the file from floppy at the users PC through Excel and...
  4. Personal.xls file is locking for editing + changing macro na…
    I store about 9 of my macro's in the personal.xls. From time-to-time, I experience some difficulties with the personal.xls: (a) I receive the error message: "Personal.xls is locked for editing" (b) I receive the error message: "A document with the name 'PERS...
  5. Macro saved in the personal.xls
    using xp os and office 2003 when I create a macro and then save the .xls sheet I am prompted to save the macro in the personal.xls and am told that the macro will be availble in all other workbooks. This is the case on other machines, but on one this one computer it does not...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: rhomulosPosted on 1999-09-15 at 19:32:23ID: 2050277

I'm also having trouble if I assign a macro to a button then it assigns as
C:\directory\filename.xls!macro
and the if I change the filename or directory path then it can no longer find the macro even if its the same file just rename and even though the macro still exists in the file, is their something wrong with my technique or is this an option thing in Excel???

 

by: antratPosted on 1999-09-15 at 20:49:02ID: 2050393

Hi rhomulos
If your macros are on a custom toolbar (Which is the best way) then try this

Sub Auto_Open
 Toolbars("YourToolbarName").Visible = True
end sub

Sub Auto_Close
 Toolbars("YourToolbarName").Delete
End sub

This way whenever the workbook is closed the full path will not be added to the macro.

whenever the workbook opens it will be available

The personal macro is a hidden sheet that runs in the background whenever you start the Application.
To view it go to Window>Unhide then you will see the personal macro worksheet then when you hit Alt+F11 you will see the Personal.xls VBA Project in the project window
Let me know if I understood you correctly
Antrat


 

by: antratPosted on 1999-09-15 at 20:52:37ID: 2050397

sorry should of mentioned that you can also attatch the toolbar to the file by going to View>Toolbars>Customize>Attatch then select the Custom toolbar and click copy
Antrat

 

by: rhomulosPosted on 1999-09-16 at 01:31:25ID: 2050772

Hello,

I started with a blank Excel97 Sheet and create two Macros and a Custom Toolbar
The Macros were added to the custom toolbar and worked fine. I then added the following code as suggested by antrat (Toolbars didn't work I had to use Application.CommandBars)

Sub Auto_Open()
    Application.CommandBars("Custom1").Visible = True
End Sub

Sub Auto_Close()
    Application.CommandBars("Custom1").Visible = False
End Sub

Unfortunately although the Auto Open/Close worked fine it still record the macro as
'C:\directory\Filename.xls'!macro1 and when I change the C:\directory\filename.xls by moving or renaming the file the toolbar still looks for the macro in the old location. :-(

Matthew

 

by: antratPosted on 1999-09-16 at 01:37:46ID: 2050782

rhomulos
Sorry about missing the Application bit.
Your Auto_Close macro must say
 
    Application.CommandBars("Custom1").Delete

Not visible=False

Antrat

 

by: rhomulosPosted on 1999-09-16 at 02:17:49ID: 2050848

If I delete it when I close down the file how will it be possible to make a non existent tool bar visible when I re open it.

I just had a test work by using Auto_Open to assign the macros to the buttons on the existing toolbar using

Application.CommandBars("Custom1").Controls.Item(1).OnAction = "Macro1"
Application.CommandBars("Custom1").Controls.Item(2).OnAction = "Macro2"

Since this reapplied the Macros to the buttons on the Toolbar at startup it was able to work even though I would change the file name.

THis is one workaround however how would a user normally record a macro, attach to a button or menu and then have it still work if the file was ever moved or renamed?  Their must be a better system then manually or programmatically reassinging macros all the time?????

 

by: antratPosted on 1999-09-16 at 02:28:31ID: 2050869

rhomulos
I know the word Delete is not a nice one but what happens is this
Once the toolbar is attatched to the Workbook it will try to make a link to it whenever the file is closed Hence the full path name.
So when you put delete in your Auto_Close macro it wont delete the Toolbar altogether but rather detach it from the Workbook.

if you are not sure just save your file in a new directory or name then try it.

Antrat
 

 

by: antratPosted on 1999-09-16 at 02:30:25ID: 2050872

But don't forget to remove the path name first from your macros before trying the Auto_Close and Open

 

by: rhomulosPosted on 1999-09-16 at 02:42:27ID: 2050893

If I delete it when I close down the file how will it be possible to make a non existent tool bar visible when I re open it.

I just had a test work by using Auto_Open to assign the macros to the buttons on the existing toolbar using

Application.CommandBars("Custom1").Controls.Item(1).OnAction = "Macro1"
Application.CommandBars("Custom1").Controls.Item(2).OnAction = "Macro2"

Since this reapplied the Macros to the buttons on the Toolbar at startup it was able to work even though I would change the file name.

THis is one workaround however how would a user normally record a macro, attach to a button or menu and then have it still work if the file was ever moved or renamed?  Their must be a better system then manually or programmatically reassinging macros all the time?????

 

by: rhomulosPosted on 1999-09-16 at 18:20:54ID: 2053025

Hello,

I have created the following code which allows me to change the filename and the location of my Excel SpreadSheet and still have the ToolBars/Macro's working everytime without User Intervention.

I'd like to know what systems other people have used in place of code like this?

**** Code Starts Here ****

Dim CustomToolBar
Dim MyTitle As String
Dim ButtonOne   As CommandBarButton
Dim ButtonTwo   As CommandBarButton
Dim ButtonThree As CommandBarButton
Dim ButtonFour  As CommandBarButton
'Automatically runs at startup
Sub Auto_Open()
    'Creates Toolbar and assigns macro's to it.
    Create_Toolbar
End Sub

Sub Auto_Close()
    'Deletes the Toolbar
    Application.CommandBars(MyTitle).Delete
End Sub


Sub Macro1()
    MsgBox ("Macro One")
End Sub

Sub Macro2()
    MsgBox ("Macro Two")
End Sub

Sub Macro3()
    MsgBox ("Macro Three")
End Sub

Sub Macro4()
    MsgBox ("Macro Four")
End Sub

'Creates ToolBar and creates four buttons and assigns four macros to them
Sub Create_Toolbar()

'Names the Command Bar
MyTitle = "Take Off"

'Creates the CommandBar
Application.CommandBars.Add(Name:=MyTitle).Visible = True

Set CustomToolBar = CommandBars(MyTitle)
'Adds the Buttons to the Tool Bar, Id:=1 means blank icon, number can be changed
Set ButtonOne = CustomToolBar.Controls.Add(Type:=msoControlButton, Id:=1)
Set ButtonTwo = CustomToolBar.Controls.Add(Type:=msoControlButton, Id:=1)
Set ButtonThree = CustomToolBar.Controls.Add(Type:=msoControlButton, Id:=1)
Set ButtonFour = CustomToolBar.Controls.Add(Type:=msoControlButton, Id:=1)
'
'Changes Button to a Caption Only Style and assigns it to Macro1
With ButtonOne
    .Style = msoButtonCaption
    .OnAction = "Macro1"
    .TooltipText = "Macro1 ToolTipText"
    .Caption = "Macro1 Caption Text"
End With

With ButtonTwo
    .Style = msoButtonCaption
    .OnAction = "Macro2"
    .TooltipText = "Macro2 ToolTipText"
    .Caption = "Macro2 Caption Text"
End With
With ButtonThree
    .Style = msoButtonCaption
    .OnAction = "Macro3"
    .TooltipText = "Macro3 ToolTipText"
    .Caption = "Macro3 Caption Text"
End With

With ButtonFour
    .Style = msoButtonCaption
    .OnAction = "Macro4"
    .TooltipText = "Macro4 ToolTipText"
    .Caption = "Macro4 Caption Text"
End With


End Sub


**** Code Finishes ****

 

by: antratPosted on 1999-09-19 at 16:34:52ID: 2058423

Hi rhomulos
Was there somthing wrong with the examples I gave you?
I don't doubt that the code you have written works, but why not just create the the toolbar with the macros yourself and let the Auto_Open and Auto_Close macros do the rest.
They will still work if the user changes the file name and location.
How did you go with the personal macro workbook?
Antrat

 

by: rhomulosPosted on 1999-09-19 at 17:26:01ID: 2058491

If I create a worksheet with a custom toolbar in it that has buttons on it with Macro's assigned and I use a line of code in the Auto_Close which deletes that toolbar how can I then send the file to somebody else.

Once I've deleted the toolbar by closing down the file how will the next person be able to use it?  I read your point at detaching the toolbar but if the Toolbar is detached and/or deleted then how can I spread the file to other users?

Could you email me a excel file where this is already setup or cut n paste the code for it perhaps???

 

by: antratPosted on 1999-09-19 at 18:11:06ID: 2058522

rhomulos
The custom Toolbars that are created are all stored in Excel5.XLB which is in the Windows directory. So custom Toolbars can be attached to XLS or XLA files and then distrubuted to any number of users.
When the person opens the file with the custom Toolbar attacthed the Toolbar will appear then when the user closes the file it wiil Automatically be added to their XLB file.
So next time the user open the file the Toolbar will be available.


Some other points that may be of use to you are that if you go into the VBE and select this workbook then Type: "Private Sub Workbook_NewSheet(ByVal sh As Object)" and this procedure place: If ActiveWork.ActiveSheet.Name <> "Your Sheetname here" Then
Toolbars("Your ToolBar here").Visible=False
Else
Toolbars("Your ToolBar here").Visible=True
End If
End sub
this way if they add another Worksheet your toolbar will not be visible.
You will also notice on the right in the Procedure Window you will now have loads of options to to play around with to make your Toolbar Visible when neccesary and not visible
at other times.
Antrat
P.S if still unsure post you Email address here and I'll send a dummy file with a toolbar attached.

 

by: rhomulosPosted on 1999-09-19 at 18:29:25ID: 2058546

I will try that out, it sounds interesting, please send dummy file to matthew@northnet.com.au

Matthew

 

by: rhomulosPosted on 1999-09-19 at 20:47:55ID: 2058733

I got the dummy file and it works the way you said it would although I cannot find a Excel5.xlb file on my machine, although I did find a mharris8.xlb file (are they related)

Anyway your toolbars("Toolbar Name").Delete certainly works well although it still seems like strange logic to me that it was required by microsoft to be that way.

How would a illiterate user create a toolbar and macro system that could be transported easily, would they too have to start writing VB code.  I can teach some of my smarter users how to do this but it increases the level of support and training they require. :-(

Please post an answer for me to accept.  Thank you.

 

by: antratPosted on 1999-09-19 at 21:08:15ID: 2058750

rhomulos
Glad to of been able to help.
The excel5.Xlb file extension was used in Excel5 and the file excel8.xlb is what is used in Excel97 so the file mharris8.xlb is most likely the one.
As for Microsofts logic regarding toolbars. I have no idea,sorry
Antrat

 

by: MoondancerPosted on 2002-03-14 at 17:22:43ID: 6866597

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...