Using macros on custom toolbars in templates.

C

Conan Kelly

Hi all,

I'm trying to macros on a custom toolbar in a template. I created the
original file (Mileage Log.xls) with macros to hide & unhide 4 specific
columns. I also have buttons on a custom toolbar assigned to these macros.
So I cleared the data in the workbook and saved it as a template (Mileage
Log.xlt). When I create a new file based on Mileage Log.xlt, I get the
security message warning me about macros and I choose "Enable". If I
attempt to run the macros, I get the following message:





'Mileage Log1.xls' could not be found. Check the spelling of the file name,
and verify that the file location is correct.



If you are trying to open the file from your list of most recently used
files on the File menu, make sure that the file has not been renamed, moved,
or deleted.









When I go into "Customize..." (customize toolbars) and check the macros
assigned to the buttons, the path is 'C:\...\Mileage Log1'!HideColumns (or
'C:\...\Mileage Log1'!UnhideColumns). Since the new file based on Mileage
Log.xlt has not been saved as "Mileage Log1.xls" and the file does not
physically exist on disk, the macro can't be found.



If I save the file as "Mileage Log 8-1.xls", I get the same error: The path
of the macros assigned to the buttons on the custom toolbar still points to
"Mileage Log1".



Is there a way to get these macros to work without actually saving the file
"Mileage Log1.xls". Is there a way to get that path to automatically change
to the new file name when it is saved? Is there a way to get the macros to
work when a new file is created based on the template without first saving
it and giving it an official name?



Thank you for any help anyone can provide,



Conan Kelly
 
B

Bob Phillips

Here is a re-post of a previous reply on this.

You could either build the toolbar when the workbook opens and destroy at
close, or attach it to the workbook. Do this by going to the View menu,
choose Tool Bars, then Customize. In that dialog, select the Toolbars tab
and click Attach. Select your command bar in the left side list box and
click Attach

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
C

Conan Kelly

Here is a re-post of a previous reply on this.
You could either build the toolbar when the workbook opens and destroy at
close, or attach it to the workbook. Do this by going to the View menu,
choose Tool Bars, then Customize. In that dialog, select the Toolbars tab
and click Attach. Select your command bar in the left side list box and
click Attach

Bob,

Is that the re-post?

Thanks for the help. Do I attach the toolbar to the template or to each new
file created with the template?

I have tried attaching the toolbar to the original file (before creating the
template), but didn't seem like "attaching" did anything. What is
"attaching" supposed to do?

Thanks again,

Conan Kelly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top