Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Create a workbook with macros from inside another macro

Hi guys.

I'm running a macro that creates a workbook with some sheets and formulas.

Now I need to put some VBA code inside this new workbook, for example, an
AutoOpen() macro.

Can someone send me an example of how can I do it (if it is possible, at
least).

Thanks in advance.

--------------------------------------------------------------------------------
Angelino Maneskul

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Create a workbook with macros from inside another macro


See Chip Pearsonm's webpage

'Programming In The VBA Editor'
(http://www.cpearson.com/Excel/vbe.aspx)


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=169187

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Create a workbook with macros from inside another macro


Hi,

an example how to do :

'----------------------------------------------
Sub Add_A_Sub_New_Workbook()

Dim Wb As Workbook, Code As String
Dim MdWb As Object, NomFeuille As String

'Write every line of you sub :
Code = Code & "Sub Auto_Open()" & vbCrLf
Code = Code & "ActiveWorkbook.Date1904 = False" & vbCrLf
Code = Code & "ActiveWindow.WindowState = xlMaximized" & vbCrLf
Code = Code & "Application.CommandBars(""Standard"").Visible =False" & vbCrLf
Code = Code & "Application.CommandBars(""Formatting"").Visib le= False" & vbCrLf
Code = Code & "Application.DisplayFormulaBar = False" & vbCrLf
Code = Code & "Application.DisplayStatusBar = False" & vbCrLf
Code = Code & "End Sub"

Application.ScreenUpdating = False
NomFeuille = ThisWorkbook.ActiveSheet.Name

Set Wb = Workbooks.Add
Set MdWb = Wb.VBProject.VBComponents.Add(1)
ThisWorkbook.Sheets(NomFeuille).Activate
With MdWb.CodeModule
.AddFromString Code
End With
Set Wb = Nothing: Set MdWb = Nothing
End Sub
'----------------------------------------------




"Angelino Maneskul" a écrit dans le message de groupe de
discussion : ...
Hi guys.

I'm running a macro that creates a workbook with some sheets and formulas.

Now I need to put some VBA code inside this new workbook, for example, an
AutoOpen() macro.

Can someone send me an example of how can I do it (if it is possible, at
least).

Thanks in advance.

--------------------------------------------------------------------------------
Angelino Maneskul

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
Macro: how to create label forms inside the worksheet not userform [email protected] Excel Programming 2 June 26th 08 07:37 AM
Does Conditional Formatting create macros in my workbook? Kristin Excel Programming 3 August 18th 06 03:23 AM
Create .NET components written in C# inside Excel Macro Tom Chau Excel Discussion (Misc queries) 0 April 11th 06 07:10 AM
How do I refer to other macros inside a macro code? Erkka Excel Programming 3 July 26th 05 03:27 PM
Macros inside macros, and pasting into macro code. pagelocator[_2_] Excel Programming 1 November 24th 04 09:11 AM


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

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

About Us

"It's about Microsoft Excel"