User below code to Export User Form from one workbook to another
Sub Mtest()
Dim wbSource As Workbook, wbDestination As Workbook
Set wbSource = Workbooks("Book1")
Set wbDestination = Workbooks("Book2")
wbSource.VBProject.VBComponents("Userform1").Export "C:\temp\Userform1.frm"
wbDestination.VBProject.VBComponents.Import "C:\temp\userform1.frm"
Kill "C:\temp\userform1.frm"
Kill "C:\temp\userform1.frx"
End Sub
Sub Mtest()
Dim wbSource As Workbook, wbDestination As Workbook
Set wbSource = Workbooks("Book1")
Set wbDestination = Workbooks("Book2")
wbSource.VBProject.VBComponents("Userform1").Export "C:\temp\Userform1.frm"
wbDestination.VBProject.VBComponents.Import "C:\temp\userform1.frm"
Kill "C:\temp\userform1.frm"
Kill "C:\temp\userform1.frx"
End Sub
No comments:
Post a Comment