View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default 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