Export and Import Userform from Excel-file to another Excel-file

M

Makelei

Hi,
How can I - using VBA - export Userform to another file - or just copy...

Using Excel 2003 SP2.

Thanks
MakeLei
 
P

papou

Hello MakeLei

Tested on Excel 2003 SP2 WinXpPro SP2:
(Make sure second file is open and amend accordingly)

Sub ExportAndImport()
Dim InitialPath$
InitialPath = ThisWorkbook.Path & Application.PathSeparator
ThisWorkbook.VBProject.VBComponents("Userform1").Export "usef.frm"
'second workbook to receive userform
Workbooks("Book.xls").VBProject.VBComponents.Import InitialPath & "usef.frm"
End Sub

HTH
Cordially
Pascal
 
M

Makelei

Hi papou,
Thanks, this works OK when Formfile is in hard drive, how could I use one
that is in network server?

BR
MakeLei
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top