Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I copy a Form from one VBAProject to another
Hi,
I have an excel 'master' file that I'm basing a subset of new files on. Basically I'm copying certain information and programming from the master file into the new files. My problem is that I have a Form in the master that I want copied into the user files. How can I do this through code? Thanks! Sean |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I copy a Form from one VBAProject to another
Sean,
The following code will copy Userform1 from Book1.xls to Book2.xls. On Error Resume Next Kill "H:\Form1.frm" On Error GoTo 0 Workbooks("Book1.xls").VBProject.VBComponents _ ("Userform1").Export Filename:="H:\Form1.frm" Workbooks("Book2.xls").VBProject.VBComponents.Impo rt _ Filename:="H:\Form1.frm" Kill "H:\form1.frm" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Sean" wrote in message ... Hi, I have an excel 'master' file that I'm basing a subset of new files on. Basically I'm copying certain information and programming from the master file into the new files. My problem is that I have a Form in the master that I want copied into the user files. How can I do this through code? Thanks! Sean |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I copy a Form from one VBAProject to another
Thanks for the help! I eventually came up with a
variation on your suggestion (although yours is more efficient!) -----Original Message----- Sean, The following code will copy Userform1 from Book1.xls to Book2.xls. On Error Resume Next Kill "H:\Form1.frm" On Error GoTo 0 Workbooks("Book1.xls").VBProject.VBComponents _ ("Userform1").Export Filename:="H:\Form1.frm" Workbooks("Book2.xls").VBProject.VBComponents.Imp ort _ Filename:="H:\Form1.frm" Kill "H:\form1.frm" -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Sean" wrote in message ... Hi, I have an excel 'master' file that I'm basing a subset of new files on. Basically I'm copying certain information and programming from the master file into the new files. My problem is that I have a Form in the master that I want copied into the user files. How can I do this through code? Thanks! Sean . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBAProject | Excel Worksheet Functions | |||
How to get rid of a VBAProject? | Excel Programming | |||
VBAProject Protect | Excel Programming | |||
code in VBAProject will not run | Excel Programming | |||
How to Delete a VBAProject | Excel Programming |