Prev: macro to sum with offset in 2 cell as other cell changed
Next: E-mail excel attachment via Lotus Notes
From: Angelino Maneskul on 12 Jan 2010 08:43 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
From: joel on 12 Jan 2010 10:30 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/showthread.php?t=169187 [url="http://www.thecodecage.com"]Microsoft Office Help[/url]
From: michdenis on 12 Jan 2010 11:05
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"").Visible= 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" <angelino(a)maneskul.com.br> a �crit dans le message de groupe de discussion : #0QL104kKHA.4872(a)TK2MSFTNGP05.phx.gbl... 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 |