Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Create New Workbook and add VBA Code to using VBA

I have and excel workbook that uses VBA to create another workbook.
There is also some vba code that I would like included in the new
workbook. What is the best way to achieve that?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Create New Workbook and add VBA Code to using VBA

You can use code to create and modify other code by using the objects and
methods that are part of the Extensibility library. See
www.cpearson.com/Excel/VBE.aspx for details and example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)


"Rligouri" wrote in message
oups.com...
I have and excel workbook that uses VBA to create another workbook.
There is also some vba code that I would like included in the new
workbook. What is the best way to achieve that?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Create New Workbook and add VBA Code to using VBA

I think I would create a template workbook (*.xlt) and use that as a basis for
the new workbook.

Then I'd use something like:

Dim NewWkbk as workbook
set newwkbk = workbooks.add(template:="C:\yourtemplate.xlt")

I think you'll find that life is lots easier if you don't have to worry about
security settings and importing the code (or copying from one workbook to
another).

But if you want to try this, check out Chip Pearson's site:
http://cpearson.com/excel/vbe.aspx


Rligouri wrote:

I have and excel workbook that uses VBA to create another workbook.
There is also some vba code that I would like included in the new
workbook. What is the best way to achieve that?


--

Dave Peterson
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
Taking specific rows from on workbook to create another workbook Michelle Excel Worksheet Functions 1 May 12th 07 04:54 AM
How to create a form to insert a hyerlink.VBA code to create a for karthi Excel Discussion (Misc queries) 0 July 5th 06 11:26 AM
VBA code to create "variable" worksheets within a workbook Chris Excel Programming 1 September 14th 05 02:08 AM
run code on opening workbook and apply code to certain sheets Jane Excel Programming 7 August 8th 05 09:15 AM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM


All times are GMT +1. The time now is 11:06 AM.

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"