Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I put a userform in a new workbook. I put a button on a worksheet in that
workbook that showed the userform. I saved that workbook as a template (and closed it). Then in another workbook, I put this code: Option Explicit Sub testme() Dim newWkbk As Workbook Set newWkbk = Workbooks.Add(template:="c:\my documents\excel\book1.xlt") End Sub The new workbook based on this template had the userform and even worked when I clicked on it. If you're asking why the userform doesn't show when you create the new workbook, try putting the code to show the userform in the Workbook_open event. Or run the auto_open code in your code. Option Explicit Sub testme() Dim newWkbk As Workbook Set newWkbk = Workbooks.Add(template:="c:\my documents\excel\book1.xlt") newWkbk.RunAutoMacros which:=xlAutoOpen End Sub "amitkr <" wrote: hi I ve a template(.xlt) file.The file contains some macros and a user form.When I open the xlt file i get the user form.. In some other workbook I ve written code to create new workbooks using the above mentioned template file as the template... Though my code creates the new workbook but that workbook does not have the user form... I want the userform to be available in each workbook I create... Any one help please --- Message posted from http://www.ExcelForum.com/ -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
help creating new hyperlinks programmatically | Links and Linking in Excel | |||
Userforms and Macros | Excel Discussion (Misc queries) | |||
Creating UserForms | New Users to Excel | |||
Storing macros, userforms | Excel Discussion (Misc queries) | |||
Creating Sub CommandButton1_Clk programmatically | Excel Programming |