View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Getting a macro to work in all workbooks

Right. I was suggesting that you have a single separate addin that contained
the code. Keep that separate from the data.

If you need any of the utilities that are in that toolbar, then distribute that
addin file, too.

This means that instead of having the same/similar code duplicated in lots and
lots of workbooks, you have that code in a single addin. If something changes
(and it will!), you'll only have to update that one addin (and redistribute it).

If you put the code into each workbook, it's gonna be a big problem to get all
the copies working correctly.



Paul wrote:

Dave

I've managed to get my floating toolbar and it comes up on my new documents
:) The next problem I seem to have is the first macro which is used copies
two of the worksheets then puts it into a what I thought was a new file then
attaches it to an email, but somewhere in the bit below I need to ensure that
it does create a new file and hopefully that way it will have the floating
toolbar on. When I try the file that I currently have the sheets are copied
but no macros are there :( But on any new document, i.e. FileNew the
floating toolbar is.

Sub Mail_SheetsArray_Outlook()
'You must add a reference to the Microsoft outlook Library
Dim OutApp As Object
Dim OutMail As Object
Dim wb As Workbook
Dim strdate As String
strdate = Format(Now, "dd-mm-yy h-mm-ss")
Application.ScreenUpdating = False
Sheets(Array("Project Record Sheet", "Tapered U Value")).Copy
Set wb = ActiveWorkbook
With wb
.SaveAs (Range("E6") & (" ") & Range("E8") & (".xls"))
'.SaveAs "Part of " & ThisWorkbook.Name _
& " " & strdate & ".xls"

Thanks for the help so far.

Paul

"Dave Peterson" wrote:

Move the macro to an addin and build a toolbar to execute the code.

Keep only the code in the template that is required in the file that should be
sent.

For additions to the worksheet menu bar, I really like the way John Walkenbach
does it in his menumaker workbook:
http://j-walk.com/ss/excel/tips/tip53.htm

Here's how I do it when I want a toolbar:
http://www.contextures.com/xlToolbar02.html
(from Debra Dalgleish's site)

Paul wrote:

Excel 2000
I've got a workbook with 4 worksheets, I have a macro which is setup to copy
two of the worksheets and email them to a different department. I also have
another macro which combines some of the cells so the address is in one line
to make it easier for the other department. The problem I have is when the
first macro is activated, it copies all of the data, as it should, but leaves
the macro information behind, so when the other department try to run their
"quicker magic address button" it doesn't work.

Is there a way to have a macro which will work for all workbooks? Or is
there away that I can get the macros to go over at the same time as the
information on the worksheets?

Thanks in advance.


--

Dave Peterson


--

Dave Peterson