PC Review


Reply
Thread Tools Rate Thread

Create New Workbook and add VBA Code to using VBA

 
 
Rligouri
Guest
Posts: n/a
 
      15th Oct 2007
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?

 
Reply With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      15th Oct 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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?
>


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      15th Oct 2007
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy two sheets from workbook & create new workbook Mike R. Microsoft Excel Programming 8 7th Aug 2009 07:09 PM
How do I call up a line of code that references a cell/range in theactive workbook workbook where I am running my macro from? Lav Microsoft Excel Programming 1 11th Nov 2008 05:04 PM
Create a vba coding from one workbook to insert data to another workbook CAM Microsoft Excel Programming 0 31st Aug 2008 06:31 AM
How do I create mathematical links from workbook to workbook? Shoobiloo Microsoft Excel Programming 2 1st Feb 2008 04:39 PM
Taking specific rows from on workbook to create another workbook =?Utf-8?B?TWljaGVsbGU=?= Microsoft Excel Worksheet Functions 1 12th May 2007 04:54 AM


Features
 

Advertising
 

Newsgroups
 


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