Macro Problems

mlopes1

Board Regular
Joined
Jul 14, 2002
Messages
114
I posted an earlier question about problems with a macro, but in trying to figure it out, have come across a lot larger issue:

I have a template that I am working on right now. When it is complete, I want to copy this template as another template for 80 or so different company folders. For example: Original.xlt becomes company1.xlt - company80.xlt

The end users will be using the company templates, not the original that I have made.
As part of this template, I have a custom toolbar with 5 separate buttons that run macros.

I seem to be having problems with some of these macros. Its as if somehow excel remembers the last workbook that the macro was used for, and therefore the buttons stop working when I try to use it in a new workbook. One example is:

I have a macro that simply changes the file status to read/write. It works fine on the original, but on any of the other workbook templates, when clicked, it tries to run on the workbook that was open the last time it was clicked. The code uses Activeworkbook.etc.etc... I never specify a named file.

basically I want these macros to be universally used by all the templates. How can I do this?

I hope I am explaining this ok. it seems confusing to even type. I hope someone can help.

Thanks.

Mark
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Hi Mark,

Not entirely sure that I follow you - are the macros designed to work on the workbook that they are contained in (ThisWorkbook) or the currently active workbook (ActiveWorkbook) ?
 
Upvote 0
Hey Richie,

Currently the code reads:

Sub Button3_Click()

Application.Dialogs(xlDialogSaveAs).Show
End Sub

I have this code in Module 1 of the Original.xlt template.

I am then copying and pasting this template into the folders of 80 "companies". I then rename the files Company1.xlt, Company2.xlt...etc.

The custom toolbar (with the saveas button that currently isnt working) is made visible in the onOpen event, so each template copy also makes the toolbar visible.

I hope that clears it up a little.


Oh, and by the way. If I create the button and assign the exact same macro, except I place it on the worksheet, and not in a toolbar, it works fine! That is Plan B, but i would rather it be on the toolbar.
Mark
This message was edited by mlopes1 on 2002-08-23 09:25
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top