Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Adding a macro to all new workbooks

I have a master workbook that creates other workbooks via VBA. Each new
workbook has a forms toolbar button. I have assigned a macro to the
button using

Set btn = ActiveSheet.Buttons.aDD(460, 1, 100, 25)
btn.OnAction = "AddInterface"
btn.Characters.Text = "Add Interface"

This seems to reference back to the macro on the sheet that is creating
the workbook. I would like each new workbook to contain a module with
the VBA code I have written, called "AddInterface", that does not
require the master sheet. Any ideas?? Thanks in advance!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Adding a macro to all new workbooks

Create a template with that code, and when adding workbooks, use the
template

Workbooks.Add template_path_and_name

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"AndrewArmstrong" wrote in message
ups.com...
I have a master workbook that creates other workbooks via VBA. Each new
workbook has a forms toolbar button. I have assigned a macro to the
button using

Set btn = ActiveSheet.Buttons.aDD(460, 1, 100, 25)
btn.OnAction = "AddInterface"
btn.Characters.Text = "Add Interface"

This seems to reference back to the macro on the sheet that is creating
the workbook. I would like each new workbook to contain a module with
the VBA code I have written, called "AddInterface", that does not
require the master sheet. Any ideas?? Thanks in advance!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Adding a macro to all new workbooks

Thanks Bob! I'll give it a shot and let you know how it turns out. I
really appreciate the help!

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
Adding data from different workbooks Bev Excel Worksheet Functions 3 January 8th 09 09:07 PM
Adding Cells in two different Workbooks STEVEB Excel Programming 2 November 9th 05 05:20 PM
Adding multiple workbooks together Keith Excel Discussion (Misc queries) 1 August 8th 05 09:39 PM
Adding a row in all workbooks within a spreadsheet ndpocohantas Excel Discussion (Misc queries) 3 April 22nd 05 09:23 AM
adding a module to several different workbooks uriel78 Excel Programming 3 March 22nd 05 04:03 PM


All times are GMT +1. The time now is 08:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"