What I need is when a user clicks a button, a new workbook is opened and is exactly the same as the source workbook so everything gets copied including userforms, etc.
This is what I have so far:
Sub Macro1()
'
' Macro1 Macro
' Macro recorded 12/21/2010 by Stewart Neuman
'
' Keyboard Shortcut: Ctrl+n
'
Dim srcWB As Workbook
Dim destWb As Workbook
Application.ScreenUpdating = False ' Prevents screen refreshing.
Set srcWB = ActiveWorkbook
Set destWb = Workbooks.Add
srcWB.Activate 'activates source workbook
srcWB.VBProject.Copy 'copies source project including all sheets, formulas, userforms, and modules, etc.
destWb.Paste 'pastes new project in new workbook
srcWB.Close 'closes source workbook
destWb.Activate 'activates new workbook
unfortunately this line doesn't work of course
srcWB.VBProject.Copy 'copies source project including all sheets, formulas, userforms, and modules, etc.
but what I have done is written in the comments what I would like to happen,but i'm not sure on how to do it exactly. can anyone help?
thanks in advance!
Bookmarks