write at exceltoexplore@gmail.com : Report Automation|Dashboard in Excel| Provide Excel consulting through macro (VBA) automation |Financial Modeling | Ethical Hacking

Sunday, 8 January 2012

Excel : Export Userform to another workbook

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

No comments:

Post a Comment